Since the server migration, the custom code Warehouse backup script has never been executed, but the environment of the original machine does not exist and you can only find it yourself. Although I know that cron is used to implement scheduled tasks, I still don't know how to do it. Today I finally got the result. The following is my implementation method (Environment Ubuntu8.04 ). 1. The use of the crontab-e command is relatively simple. Enter directly ~ # Crontab-e will open an editing window. The first line will contain the content format prompt :#
Since the server migration, the custom code Warehouse backup script has never been executed, but the environment of the original machine does not exist and you can only find it yourself. Although I know that cron is used to implement scheduled tasks, I still don't know how to do it. Today I finally came up with the result. The following is my implementation method (Environment Ubuntu 8.04 ).
1. Use the crontab-e command
This command is easy to use. Enter directly
~ # Crontab-e
An editing window will be opened. The first line will show the content format prompt:
# M h dom mon dow command
Specific meaning: minute Hour Date month week command, in a month (mon) One day (dom) or the day of the week (dow) (h, 24 hours) A minute (m) executes a command, * indicates any time. For example:
3 ***/home/meng/hello. sh
That is, execute the hello. sh script under/home/meng/at 03 every hour.
After saving the file, press Ctrl + X at the bottom of the screen to exit. The system prompts whether to save the file and enter Y. The system prompts you to enter the file name and a temporary file name. Because it is only a test, press enter to save the settings.
Note: After editing, restart the cron process:
~ #/Etc/init. d/cron restart
Observe the running result and you will find that hello. sh is executed every hour.
When using this command, the biggest concern is whether the command can be successfully executed after the system is restarted? After I restarted the system, I found everything was normal, so I dispelled this concern. However, there is still a problem. Generally, the server is logged on after restart, and no user logs in. If I am not using the root account when executing the crontab-e command, will the system be successfully executed after the system is restarted?