I have a bash script that it should start at a specific time. I used from at command. When I run it with at, the job create and after the time the job start but it doesn't do it's work. When I run the script without at it works well. I think the problem is bash because it runs sh scripts.
This a part of my script:
#!/usr/local/bin/bash
IFS=' ' read -r -a array <<< "$LIST"
for element in "${array[@]}"
do
touch /tmp/$element.call
cat >> /tmp/$element.call <<-EOF
Channel: SIP/${element}
Application: Playback
Data:${FILE}
Callerid: ${CALLERID}
EOF
mv /tmp/$element.call /var/spool/asterisk/outgoing/
done
I run the at command like below:
export FILE=hello-world.gsm LIST=4001 5001 6001 CALLERID=123; sudo -E at -t 20210140636.00 -f /usr/local/bin/asterisk_wakeup_call.sh
would you please help me to find the problem?
Thanks
echo test $FILE $LIST $CALLERID > /home/fm/at-testin the beginning. I assume that the variables are not exported as expected.#!/usr/local/bin/bash -xand check the logs for the output. Anything obvious there?atit doesn't show logs. I run script withoutatit worked.FILE=hello-world.gsm LIST=4001 5001 6001 CALLERID=123 /usr/local/bin/asterisk_wakeup_call.shatis being run from the original user's queue, but the sudo privilege has expired, or cannot be reinstated by the daemon that runs the job.