Shell script not running via crontab, but runs fine manually

前端 未结 8 639
清歌不尽
清歌不尽 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:42

    Was having a similar problem that was resolved when a sh was put before the command in crontab

    This did not work :

    @reboot ~myhome/mycommand >/tmp/logfile 2>&1
    

    This did :

    @reboot sh ~myhome/mycommand >/tmp/logfile 2>&1
    

提交回复
热议问题