Shell script not running via crontab, but runs fine manually

前端 未结 8 638
清歌不尽
清歌不尽 2020-12-17 01:25

I have a script that checks if pptp vpn is running , and if not it reconnect the pptp vpn , when i run the script manually it execute fine , when i do set a cron job , is no

8条回答
  •  情话喂你
    2020-12-17 01:39

    finally i found a solution ... instead of entering the cronjob with

    crontab -e
    

    i needed to edit the crontab file directly

    nano /etc/crontab
    

    adding e.g. something like

    */5 *     * * *   root  /bin/bash /var/scripts/vpn-check.sh
    

    and its fine now!

    Thank you all for your help ... hope my solution will help other people as well.

提交回复
热议问题