crontab to .sh will not run.

Kernels & Hardware, configuring network, installing services

crontab to .sh will not run.

Postby 1885 » 2017-04-12 01:21

I'm calling a shell script that calls a shell script from crontab and it will not run.
Please throw me a bone. The script is called every minute to test it.

crontab -e
*/1 * * * * /bin/bash -l /home/cwc/bash/pingall.sh

note:
/home/cwc/bash/pingall.sh
runs fine from cli

code for pingall.sh
NOW=$(date +"%Y-%m-%d-%T");
LOGFILE="PING-$NOW.txt";
touch $LOGFILE;
/home/cwc/bash/ping.sh >> $LOGFILE;

code for ping.sh
for ip in $(seq 1 5);
do
ping 192.168.1.$ip -c3;
done

Thanks.
1885
 
Posts: 79
Joined: 2014-06-05 04:23

Re: crontab to .sh will not run.

Postby 1885 » 2017-04-12 02:07

removing the touch seemed to help.

NOW=$(date +"%Y-%m-%d-%s");
LOGFILE="log-$NOW.txt";
/home/cwc/bash/ping.sh >> /home/cwc/bash/$LOGFILE;

this was only tested on gentoo
1885
 
Posts: 79
Joined: 2014-06-05 04:23


Return to System configuration

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable