linux - Starting pppd from cron doesn't work -
i want start pppd whenever disconnects. trying setup shell script run every 1 minute see if it's down , reconnect.
i have bash script called vpn-check.sh
:
ping -c3 10.8.3.0 > pingreport result=`grep "0 received" pingreport` truncresult="`echo "$result" | sed 's/^\(.................................\).*$/\1/'`" if [[ $truncresult == "3 packets transmitted, 0 received" ]]; pon vpnname fi
when run script cli directly, works , starts ppp when run same through cronjob (for root user), doesn't work.
i tried below , didn't work
*/1 * * * * bash /root/vpn-check.sh > /root/cronlog.txt 2>&1
i tried below , didn't work
*/1 * * * * /root/vpn-check.sh > /root/cronlog.txt 2>&1
finally, tried:
*/1 * * * * /usr/sbin/pppd call vpnname> /root/cronlog.txt 2>&1
can't figure out wrong.
i fixed it. while running crontab -e user name added, needs added syste-wide cron file found under /etc/crontab
user starts job can added in above mentioned system wide cron file.
Comments
Post a Comment