OS Ubuntu 16.04 Need to run leafpad using cron at odd minutes of the current hour on odd days. I use for November 18, 04 hours.

1-59/2 4 */2 1-12 0-7 DISPLAY=:0 leafpad 1-59/2 4 2-31/2 1-12 0-7 DISPLAY=:0 leafpad 

But these commands do not work for both the 18th and 19. The next command works (opens leafpad) for both 18 and 19.

 1-59/2 4 1-31/2 1-12 0-7 DISPLAY=:0 leafpad 

Please explain my mistake?

  • If the step for the date of the month does not work, insert the explicit listing: 1,3,... in order not to type manually, you can generate the lines: $ seq -s , 1 2 31; seq -s , 2 2 31 $ seq -s , 1 2 31; seq -s , 2 2 31 . // and, yes, 1-12 and 0-7 are redundant listings. both of them can be replaced with asterisks. - aleksandr barakin 2:41

1 answer 1

judging by the content of this answer , the even dates of the month should be indicated as follows:

 2-30/2 

and odd so:

 1-31/2 

and, yes, to indicate "any month", you do not need to write 1-12 , it is enough * . Similarly, to indicate "any day of the week": instead of 0-7 also sufficient * .

  • 3
    I'll tell you more, for the day of the week * and 0-7 are not the same thing. According to the documentation, if both the fields "day of the month" and "day of the week" are indicated (ie, differ from * ), then the command will start when at least one of the conditions is met. Thus, if you specify the day of the week as 0-7 , the command will run every day, regardless of the day of the month. - Roman