How to run a cron job on every Monday, Wednesday and Friday?

后端 未结 7 952
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 06:18

How can one run a cron job for every Monday, Wednesday and Friday at 7:00 pm?

7条回答
  •  清歌不尽
    2020-12-08 06:47

    Here's my example crontab I always use as a template:

        # Use the hash sign to prefix a comment
        # +---------------- minute (0 - 59)
        # |  +------------- hour (0 - 23)
        # |  |  +---------- day of month (1 - 31)
        # |  |  |  +------- month (1 - 12)
        # |  |  |  |  +---- day of week (0 - 7) (Sunday=0 or 7)
        # |  |  |  |  |
        # *  *  *  *  *  command to be executed
        #--------------------------------------------------------------------------
    

    To run my cron job every Monday, Wednesady and Friday at 7:00PM, the result will be:

          0 19 * * 1,3,5 nohup /home/lathonez/script.sh > /tmp/script.log 2>&1
    

    source

提交回复
热议问题