Crontab The Timer
Did you usually do something Like download Linux Iso(s) in the middle of the night? (cheap internet traffic reason)Or you have to do something in the future but in the same time you must meet your boss?
The best solution is using crontab.
Command
Just type these command below to use crontab:
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.
crontab -v # Display the last time you edited your crontab file.
File Syntax
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Example
A line in crontab file like below removes the temporary files from /home/myuser/tmp each day at 7:00 AM.
* 17 * * * rm /home/myuser/tmp/*
The best solution is using crontab.
Command
Just type these command below to use crontab:
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.
crontab -v # Display the last time you edited your crontab file.
File Syntax
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Example
A line in crontab file like below removes the temporary files from /home/myuser/tmp each day at 7:00 AM.
* 17 * * * rm /home/myuser/tmp/*