Hi all,
I do have a problem that took me hours to solve, but without success.
I have a script fired by cron every 15 minutes. It check if node T1 is present in the node lists. If not it connects to it.
While the script works perfectly when fired manualy, it fails under cron.
The CHK variable is always 0 (zero), as if the test were never performed.
I’ve checked everything that was in my knowledge… I’m stucked.
Does someone has an idea ?
Here my script :
#!/bin/bash
date >> /usr/tknet/cron_check.txt
CHK=
echo "Checking if connected to the hub"
CHK=`asterisk -rx "rpt nodes 2" | grep -c "T1"`
echo $CHK >> /usr/tknet/cron_check.txt
if [ $CHK -eq 1 ]
then
echo "OK, Connected."
echo "OK, connected." >> /usr/tknet/cron_check.txt
else
echo "Reconnecting."
echo "Reconnecting." >> /usr/tknet/cron_check.txt
asterisk -rx "rpt cmd 2 ilink 3 1"
fi
Subsidiary question: does the asterisk scheduler use the same process as cron and can it schedule a script ?
73 Patrick