Hello, I need to run cron task to run my shell script file daily at 03:00 am time/after reboot.
I have successfully installed cron from entware but still no luck with scheduling my script file .
For first test I have added line to start my script every 5 min...
/opt/etc/crontab:
S99skrypt2.sh:
I have successfully installed cron from entware but still no luck with scheduling my script file .
For first test I have added line to start my script every 5 min...
/opt/etc/crontab:
Else I have problem with privileges as I think:SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
*/1 * * * * admin /opt/bin/run-parts /opt/etc/cron.1min
*/5 * * * * admin /opt/bin/run-parts /opt/etc/cron.5mins
01 * * * * admin /opt/bin/run-parts /opt/etc/cron.hourly
02 4 * * * admin /opt/bin/run-parts /opt/etc/cron.daily
22 4 * * 0 admin /opt/bin/run-parts /opt/etc/cron.weekly
42 4 1 * * admin /opt/bin/run-parts /opt/etc/cron.monthly
*/5 * * * * admin /opt/etc/cron.d/S99skrypt2.sh
Normally script works correctly of course.admin@RT-AC55U:/tmp/home/root# crontab -e
You (admin) are not allowed to use this program (crontab)
See crontab(1) for more information
admin@RT-AC55U:/tmp/home/root#
S99skrypt2.sh:
#!/bin/sh
while ping -q -c 1 -w 1 10.200.1.99 >/dev/null ;
do echo "$(date '+%Y-%m-%d %H:%M:%S') Server responding" 2>&1 >> /opt/log.txt && sleep 10 ;
done ;
echo "$(date '+%Y-%m-%d %H:%M:%S') Server stopped responding" 2>&1 >> /opt/log.txt