poindexter
New Member
Hey Forum, I have a Debian build here and I am trying to get a 4g modem to work on it. I have managed to get it working but I cannot get the configuration to persist after a reboot.
There is one simple AT command that I need to send to the modem to make it connect. When I run it manually it works but I need to connect to this device remotely and without the ability to login locally to run the command.
The command that needs to execute is below. I put this into a .sh file and made it executable.
echo -e "AT#ECM=1,0\r" | sudo minicom -D /dev/ttyUSB2 -b 115200
date=$(date)
echo $date >> /home/username/modemlog.txt
I tried running it from a cronjob both on a 2 minute schedule and also @reboot but neither worked. I know it ran the script because I saw the date log in modemlog.txt. It just didn't initialise the modem.
So my next attempt was to run it as an init script in /etc/init.d followed by update-rc.d. Of course I made the script executable. The script ran but again, it didn't do the business with the modem. When checking the service status it didn't look like it was running the full command. All I could see was sudo minicom -D /dev/ttyUSB2 -b 115200 which doesn't do the job.
There is something fundamental that I am missing here. I have tried using the full path to the minicom command and the full path to the ping command but this still didn't work.
Any suggestions on how I can get this command to execute at bootup and before user login would be greatly appreciated!!
Many thanks
There is one simple AT command that I need to send to the modem to make it connect. When I run it manually it works but I need to connect to this device remotely and without the ability to login locally to run the command.
The command that needs to execute is below. I put this into a .sh file and made it executable.
echo -e "AT#ECM=1,0\r" | sudo minicom -D /dev/ttyUSB2 -b 115200
date=$(date)
echo $date >> /home/username/modemlog.txt
I tried running it from a cronjob both on a 2 minute schedule and also @reboot but neither worked. I know it ran the script because I saw the date log in modemlog.txt. It just didn't initialise the modem.
So my next attempt was to run it as an init script in /etc/init.d followed by update-rc.d. Of course I made the script executable. The script ran but again, it didn't do the business with the modem. When checking the service status it didn't look like it was running the full command. All I could see was sudo minicom -D /dev/ttyUSB2 -b 115200 which doesn't do the job.
There is something fundamental that I am missing here. I have tried using the full path to the minicom command and the full path to the ping command but this still didn't work.
Any suggestions on how I can get this command to execute at bootup and before user login would be greatly appreciated!!
Many thanks