crontab for scheduled tasks

# crontab e

Enter and edit the user-defined crontab configuration file, it will be written to the /var/spool/cron directory, and a file with the same user name will be generated. The content of the file is the timing script we edited.

# vi /etc/crontab

Enter the system's crontab configuration file

 

Format of the crontab file:

{minute} {hour} {day-of-month} {month}{day-of-week} {full-path-to-shell-script}

o minute: the range is 0 59

o hour: the range is 0 23

o day-of-month: the range is 0 31

o month: The range is 1 12. 1 is January . 12 is December .

o Day-of-week: The range is 0 7. Sunday can be 0 or 7.

 

Example: 00 * * * /XXX/XXXX/XXXXXXXX.sh

This will run the specified .sh file every morning

 

Valid options for crontab :

crontab - e : Modify the crontab file . If the file does not exist, it will be created automatically.

crontab -l : Display the crontab file.

crontab -r : Delete the crontab file.

crontab -ir : Alert the user before deleting the crontab file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324473561&siteId=291194637