This is different than the system-wide crontab ( /etc/crontab). Sudo crontab -e -u root edits crontab for the user root. So I am assuming it at least triggered to run, but there is no new information on the text file.Īnd it does not appear that the duplicity backup is running as there are no new files in the backup directory. Shows May 28 03:00:01 CRON: (root) CMD (root /home//Scripts/Backups/DuplicityBackup.sh) Running grep DuplicityBackup.sh /var/log/syslog Running the script itself as root starts the backup and writes to the text file. PASSPHRASE='' duplicity /usr/share/nginx/data file:///dysonbackup/datadir &> /home//Scripts/Backups/backup_logs/data_backup_log.txt The script has commands to write to a text file like this: echo "Creating backup of data directory" I set it up like this: sudo crontab -e -u rootĪnd added the line: 00 03 * * * root /home//Scripts/Backups/DuplicityBackup.sh The above examples shows how to do those things.Instead of specifying values in the 5 fields, we can specify it using a single keyword as mentioned below.I have a duplicity backup script set to run once per day through the root cron tab. But you may have a requirement of executing the command only during certain hours or vice versa. It executes the specified command check-disk-space every 10 minutes through out the year. */10 * * * * /home/maverick/check-disk-space Use the following, if you want to check the disk space every 10 minutes. 00 – 0th Minute (Top of the hour) 09-18 – 9 am, 10 am, 11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm * – Every day * – Every month 1-5 -Mon, Tue, Wed, Thu and Fri (Every Weekday)ħ.To schedule a background Cron job for every 10 minutes.Cron Job every weekday during working hours : This example checks the status of the database every weekday (i.e excluding Sat and Sun) during the working hours 9 a.m – 6 p.m.Ġ0 09-18 * * 1-5 /home/maverick/bin/check-db-status.00 – 0th Minute (Top of the hour) 09-18 – 9 am, 10 am, 11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm * – Every day * – Every month * – Every day of the week.Cron Job everyday during working hours : This example checks the status of the database everyday (including weekends) during the working hours 9 a.m – 6 p.mĠ0 09-18 * * * /home/maverick/bin/check-db-status.Only on Weekdays) If you wanted a job to be scheduled for every hour with in a specific range of time then use the following. 00 11, 16 * * * /home/maverick/bin/incremental-backupĠ0 – 0th Minute (Top of the hour) 11, 16 – 11 AM and 4 PM * – Every day * – Every month * – Every day of the week 6.To schedule a job for certain range of time (e.g. The comma separated value in a field specifies that the command needs to be executed in all the mentioned time. This example executes the specified incremental backup shell script (incremental-backup) at 11:00 and 16:00 on every day. Twice a Day) The following script take a incremental backup twice a day every day. 5.To schedule a job for more than one time (e.g. Thus the above convention can be used for all the other 4 fields. When you specify 0-10/2 in minute field mean every 2 minutes in the first 10 minute. When you specify */5 in minute field means every 5 minutes. More than using this * directly, you will find it very useful in the following cases. The * means all the possible unit - i.e every minute of every hour through out the year. But understanding this example will help you understand the other examples. Ideally you may not have a requirement to schedule a job every minute. 4.To schedule a job for every minute using Cron. By default this will edit the current logged-in users crontab. To view crontab entries of other Linux users : Login to root and use -u -l.ģ.To edit Crontab Entries Edit Current Logged-In User’s Crontab entries.To edit a crontab entries, use crontab -e.View Root Crontab entries : Login as root user (su – root) and do crontab -l.View Current Logged-In User’s Crontab entries : To view your crontab entries type crontab -l from your unix account.Software Engineering Interview Questions.Top 10 System Design Interview Questions and Answers.Top 20 Puzzles Commonly Asked During SDE Interviews.Commonly Asked Data Structure Interview Questions.Top 10 algorithms in Interview Questions.Top 20 Dynamic Programming Interview Questions.Top 20 Hashing Technique based Interview Questions.Top 50 Dynamic Programming (DP) Problems.Top 20 Greedy Algorithms Interview Questions.Top 100 DSA Interview Questions Topic-wise.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |