I'm using Debian 6.0.6. I edited root crontab a few days ago to add this line:
00,10,20,30,40,50 * * * * /root/Scripts/con_switch6.sh >> /var/log/con_switch_diario.log 2>&1
I'm connecting to this linux server using Putty. Meanwhile Putty console is opened and connected a line is generated inside the file "con_switch_diario.log" every 10 minutes (i.e., the script is running).
But when I closed that Putty console (i.e., the ssh connection is finished) and then I reopened it, I found that there aren't entries on that log file during that lapse of time. I did some tests and I found that when the console is closed the script is not executed by crontab.
The content of the script is this:
#!/bin/sh IPcorreo="22.214.171.124" IP1="192.168.10.125" IP2="192.168.10.154" maxPloss="15" IPfirewall=`traceroute -m 3 $IPcorreo | grep $IP1` if [ $? -eq 0 ] then echo "$IPfirewall: `date`" ploss=$(ping -q -w30 $IPcorreo | grep -o "[0-9]*%" | tr -d %) > /dev/null 2>&1 if [ "$ploss" -gt "$maxPloss" ] then /usr/bin/expect /root/Scripts/delete.exp sleep 60 echo "Switch Email: `date`" | mail -s System firstname.lastname@example.org fi else traceroute -m 3 $IPcorreo | grep $IP2 fi
I don't know how could I fix this problem. Thank you for your help.
PS: in the same server, inside crontab I have defined others scripts... all they are running ok everyday. The only difference I found between them is they use
But even if I change it on my script to use bash I still have the same problem.