Running a cron job 3 times (1 pm, 2 pm and 3 pm for example)?

后端 未结 4 1365
迷失自我
迷失自我 2020-12-13 12:33

I am not sure how to run a cron job at 3 specific hours every day. I want to run it at 1pm, 2 pm and 3pm.

Is it possible, using a single expression?

4条回答
  •  孤城傲影
    2020-12-13 13:19

    While the given answers are correct, an unexperienced user might not know where to put this expression. You have to edit the crontab file, like:

    crontab -e
    

    There you add

    0 13,14,15 *   *   *     /home/user/command
    

    to execute your command at 13:00, 14:00 and 15:00. Also note that user has to be substituted with the user account the command is executed in.

提交回复
热议问题