USSD commands in crontab RUT241

Hi,
I’d like to have a daily e-mail with the mobile data usage.
For this I try to use crontab and gsmctl -U command.
But…
When I run command:
gsmctl -U *100#
then I get the correct response.
But when I try do the same daily in crontab using the following:
0 6 * * * gsmctl -U *100#
then I get a response like this:
+CME ERROR: retry operation
When I browse the syslog I see:
cron.err crond[7090]: USER root pid 704 cmd gsmctl -U *100
Does it meat that there’s some issue with the last character “#” and should it be written with some prefix?

Hello,

Have you tried escaping with slashes like so?:

gsmctl -U \*100\#

You can also put the command into a script. Create script:

vi /etc/yourscript.sh

Press ‘i’ to start editing. Paste:

#!/bin/bash
gsmctl -U *100#

Press ESC and type ‘:wq!’ to save the script.

Add execution rights:

chmod +x /etc/yourscript.sh

Add script to crontab:

0 6 * * * /etc/yourscript.sh

Kind Regards,

1 Like

Hi,

Thank you dude!
Adding backslash didn’t help but using scripts works fine!
I’ve made only a little correction inside the script: #!/bin/sh (instead of bash)

Thanks and regards!
Dominik

This topic was automatically closed after 15 days. New replies are no longer allowed.