Start a Cron job twice a week or the first wednesday every month or every vear on 1st sunday!
[EDIT] At first I used MON, TUE, THU and so on,maybe that was part of the problem? But I did not try it out so far…
My config:
1 # Please use dietpi-cron to change cron start times
2 SHELL=/bin/dash
3 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4 MAILTO=""
5
6 # m h dom mon dow user command
7 #*/0 * * * * root cd / && run-parts --report /etc/cron.minutely
8 17 * * * * root cd / && run-parts --report /etc/cron.hourly
9 35 19 * * 1,4 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
10 18 19 * * 6 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
11 30 7 * * 7 root [ $(date +\%d) -le 07 ] && (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; })
BTW, dietpi-cron changed my crontab!! Before I wanted to do cron jobs without dietpi-cron but it failed to start though I restarted cron by
service cron restart
This is config of dietpi-cron:
/e/crontab 1 # Please use dietpi-cron to change cron start times
2 SHELL=/bin/dash 3 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4 MAILTO=""
5
6 # m h dom mon dow user command
7 #*/0 * * * * root cd / && run-parts --report /etc/cron.minutely
8 17 * * * * root cd / && run-parts --report /etc/cron.hourly
9 25 1 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
10 18 23 * * 4 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
11 30 7 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
~ /etc/crontab CWD: /root Line: 9
Since i used dietpi-cron it starts at least… The crontab above is what I have restored
My idea is, how does dietpi-cron and /etc/crontab interact here? How can I run my crontab here?
I need this respecially for my ssd snapshots which take a long time to finish (up to half a day).
And off topic😎: is it possible to schedule a cron job every on 1st sunday? I guess it would be similar like in line 11 of my first script. Or a script to check the conditions…