cron scheduled task learning

reference

Detailed explanation and usage tutorial of Crontab (scheduled task) command in Linux_tianles' blog-CSDN blog

Prepare a virtual machine

kali comes with cron


Set up scheduled tasks

crontab -e #Edit cron task mode

Very annoying. He is using an editor of nano, not vim. You can press F1 to view the help.

alt+z can close the annoying prompt below, alt+x can close the above prompt

In the nano editor, you can exit and save the file by following these steps:

  1. Press Ctrl + X, which will display a bottom line.
  2. At the prompt, press the Y key to confirm saving changes.
  3. If you need to change the file name or select other options, follow the prompts. If you want to save and overwrite the original file, just press the Enter key.
  4. If you want to discard changes to the file without saving, you can press the N key or enter another option and then press the Enter key.

We write directly

* * * * * touch /root/1.txt

service crond restart #Restart the crontab service and use it to run cron successfully.

crontab -l View scheduled tasks

crontab execution time calculation - online tool (tool.lu)

Guess you like

Origin blog.csdn.net/m0_71274136/article/details/133637795