Running a cron job on Linux every six hours

后端 未结 7 865
旧巷少年郎
旧巷少年郎 2020-11-29 19:32

How can I run command every six hours every day?

I tried the following, but it did not work:

/6 * * * * *  mycommand
7条回答
  •  情书的邮戳
    2020-11-29 19:43

    You should include a path to your command, since cron runs with an extensively cut-down environment. You won't have all the environment variables you have in your interactive shell session.

    It's a good idea to specify an absolute path to your script/binary, or define PATH in the crontab itself. To help debug any issues I would also redirect stdout/err to a log file.

提交回复
热议问题