Use the
regular_run_cmdfile feature. See also description of other
regular_run* settings.
Create this directory, and make it writable for smsd:
/var/spool/sms/regular_runIn the modem section of smsd.conf, define:
regular_run_cmdfile = /var/spool/sms/regular_run/GSM1.cmdfileregular_run_statfile = /var/spool/sms/regular_run/GSM1.statfileThis might also be useful:
regular_run_logfile = /var/log/smsd_regular_run.logDefault interval for handling this file is 300 seconds. It can be changed with a setting:
regular_run_interval = 60After changing the configuration. restart smsd and check that it's started without any error messages.
When you need to load the credit, store proper USSD command to the GSM1.cmdfile. Write something like this to the first line:
AT+CUSD=1,"*140*123456789#"Smsd will send this command to the modem, and you can see the answer in the GSM1.statfile. After the cmdfile is handled, it is removed by smsd, so it does not try to load more credit with the same code.