in Education by
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)

1 Answer

0 votes
by
The syntax is correct. cron must have triggered execution for line 3 on Aug 7. And yes, you should have received an email on Aug 07, independent of outcome (and even existence) of the backup script. If you did not not receive an email, possible reasons are: cron was down (or the entire machine was) you configured a bad SHELL for cron the mail service was down. I'd check the syslogs for cron execution, email submission, and for execution of mysqlbackup.

Related questions

0 votes
    I would like to get the exit code of my remote command. It's normally pretty easy, but I need ... -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@$ip_server bash...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    what is the difference between this two commands? sudo setfacl -R -m u:www-data:rwx -m u:yourname ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    what is the difference between this two commands? sudo setfacl -R -m u:www-data:rwx -m u:yourname ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Some seats were reserved for women to increase their participation in political process. Please answer the above question....
asked Aug 14, 2022 in Education by JackTerrance
0 votes
    Name some nationalities that were part of the Soviet Union. Please answer the above question....
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    we're planning to use some robotics for copy and paste some routine information to our internal tool. ... machine learning concepts Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    we're planning to use some robotics for copy and paste some routine information to our internal tool. ... machine learning concepts Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    Simran write a code print: (“hello friends”)but when she executed there comes an error what was the error and why did it occur Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    In my case, savepoint was set in Java and I am trying to rollback in a plsql procedure which was ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I'm adapting my app to Swift 3 and I'm encountering this problem. This used to work on Swift 2. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I've inherited a codebase that implements a half-baked implementation of custom intents and shortcuts. One ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
...