-
- Is a long-running process that executes commands at specific dates and times. You can use this to schedule activities, either as one-time events or as recurring tasks.
-
Crontab -e
→ Edit your crontab file, or create one if it doesn't already exist.crontab -l
→ Display your crontab file.crontab -r
→ Remove your crontab file.
-
minute(s) hour(s) day(s) month(s) weekday(s) command(s)
Field value Description minute 0-59 The exact minute that the command sequence executes. hour 0-23 The hour of the day that the command sequence executes. day 1-31 The day of the month that the command sequence executes. month 1-12 The month of the year that the command sequence executes. weekday 0-6 The day of the week that the command sequence executes (Sunday = 0, Monday = 1, Tuesday = 2, and so forth). -
-
Any of these fields can be set to an asterisk (*), which stands for "first through last". For instance, to run a job every month, put * in the month field.
- 0 0 * 0 0 /home/john/full-backup
-
Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive; for example, 8-11 for an "hours" entry specifies execution at hours 8, 9, 10 and 11.
- 0 8-11 0 0 0 /home/john/full-backup.
-
- 0 0 1,3,4 0 0 /home/john/full-backup
-
Step values can be used in conjunction with ranges. if you want to say "every two hours", you can use "*/2".
- 0 */2 0 0 0 /home/john/full-backup
-
- Names can also be used for the "month" and "day of week" felds. Use the frst three letters of the particular day or month (case doesn't matter). Ranges or lists of names are not allowed.
We can archive files using “tar
or gzip
”. There are differences between them.
-
- is a file archiving technique which combines multiple file into single file archive. It’s very useful when you want to transfer some files from one server machine to another. Combining multiple files using “tar” is helpful to upload and transfer files simply.
-
- is file compression technique used to compress files which have a large size. By using this file compression technique, we can simply reduce the file size before sending/transferring it from source to destination. We can also decompress the compressed file at the destination.
-
tar -cvf archive.tar file1.txt file3.txt
-
tar -xvf archive.tar
-
gzip test.txt
-
gunzip test.txt.gz
-
tar -zcf fiie.tar.gz fiie2.txt fiie1.txt
-
0 0 1 10 0 tar -zcf /home/john/archive.tar.gz /home/