'No cursor motion capability occurs when startup linux script execute minicom script with at commands
I have created a startup Linux script for a board that runs Debian jessie Armbian 8.1. I need at startup to run at command in a modem attached to it via USB interface. I've put the script inside rc.local:
#!/bin/sh -e
cd /home/user/Script/
sh script.sh
exit 0
In the folder Script I have a script:
#!/bin/sh
minicom -S at_command.txt
The at_command contains:
send at+creg=1
send exit
! killall minicom
The issue is that when I run the script manually it works correctly,
however when I start the the board the at commands do not execute.
Since the board is Debian I also followed the link: ttp://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html and to adapt the script to run according LSBInitScripts but I got the same behavior. When running sudo /etc/init.d/myScript start
manually everything works great, but after Linux startup no at_command is executed. I added in the rc.local the following commands for debugging:
set -x;
exec 2>>/home/user/Script/minicom-rc.log;
date +"$0 %c" >&2
And in the generated log file I got this printout:
+ date +/etc/rc.local %c
/etc/rc.local Fri 02 Mar 2018 04:02:43 PM EET
+ cd /home/user/Script/
+ sh script.sh
No cursor motion capability (cm)
What I have done wrong?
Solution 1:[1]
I am guessing it is related to there being no terminal during startup.
Maybe try adding the following line before starting minicom
:
export TERM=linux-c-nc
Solution 2:[2]
In this scenario you alternatively use my atinout program which is a program specifically made for sending AT commands to a modem from the command line (assuming the modem is /dev/ttyUSB0):
echo at+creg=1 | atinout - /dev/ttyUSB0 -
or possibly
atinout /home/user/at_commands.txt /dev/ttyUSB0 /dev/null
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mark Setchell |
Solution 2 | hlovdal |