I have the following cronjobs in my crontab:
0 22 * * 1-6 /root/sbin/mysqlbackup --conf-dir=/root/etc/backup --source=MonitoringServer --set-name=$(date +"\%A") 2>&1 | mail -s "Backup /MonitoringServer"
[email protected]
0 22 * * 0 [ "`date +\%d`" -gt 7 ] && /root/sbin/mysqlbackup --conf-dir=/root/etc/backup --source=MonitoringServer --set-name=Woche$((($(date +\%-d)-1)/7+1)) 2>&1 | mail -s "Backup /MonitoringServer"
[email protected]
0 22 * 2-12 0 [ "`date +\%d`" -lt 8 ] && /root/sbin/mysqlbackup --conf-dir=/root/etc/backup --source=MonitoringServer --set-name=$(date +"\%B") 2>&1 | mail -s "Backup /MonitoringServer"
[email protected]
0 22 * 1 0 [ "`date +\%d`" -lt 8 ] && /root/sbin/mysqlbackup --conf-dir=/root/etc/backup --source=MonitoringServer --set-name=$(date +"\%Y") 2>&1 | mail -s "Backup /MonitoringServer"
[email protected]
Whereas the first line should generate the backup every monday till saturday (works). The second line should generate a backup every sunday using the week of month as name, except for the first week (works). The third line should be executed every first sunday of the months february till december (does not work). The last line should be executed every first sunday of a year (unknown if called).
Everything seems right for me. Can anybody tell me why the third line does not work?
update
✓ root@mirror ~$ echo $(date +"%B");
September
✓ root@mirror ~$ [ "`date +%d`" -lt 8 ] && echo "Test"
Test
✓ root@mirror ~$ echo "`date +%d`"
02
update
no mail was sent on august, 7th (firs sunday of last month). means if the job would have been executed there had to be at least an empty mail?
update
/root/sbin/mysqlbackup --conf-dir=/root/etc/backup --source=MonitoringServer --set-name=$(date +"\%B")
performs well using a sh shell (which is used by cron by default) and using a bash shell (which is configured at the beginning of the crontab).
19 8 * 2-12 5 [ "`date +\%d`" -lt 8 ] && echo $(date +"\%B") 2>&1 | mail -s "Backup /MonitoringServer"
[email protected]
performed well, too. Mail recieved containing the month's name.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)