Detailed usage of Task Scheduler (at, crontab) on Linux systems

Source: Internet
Author: User

What we bring to you today is the introduction of the use of at Crontab

    • command to run a task at a time

Syntax: at (option) (parameter)

-F: Specifies the task file containing the specific instructions;

-Q: Specifies the queue name for the new task;

-L: Displays a list of tasks to be performed;

-D: Deletes the specified pending task;

-M: Sends an e-mail message to the user after the task executes.

After you finish writing the command, Ctrl+d submit the task.

Example: 1 days after the 4 o'clock in the morning run Echo Taotao

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/BA/wKioL1XsOyKTuW2AAACPJuxm7dQ202.jpg "title=" 7.png " alt= "Wkiol1xsoyktuw2aaacpjuxm7dq202.jpg"/>

    • Crontab

      Command description: The crontab command is used to submit and manage users ' tasks that need to be performed periodically, similar to the Scheduled tasks under Windows

      Syntax Crontab (option) (parameter)

crontab [-u user] [-l |-r |-e]

-u User: Not to manage your own cron task, but to specify the target user's cron task; Root has the ability to manage other users ' cron tasks; default management of their own;

-l:list, list the tasks;

-r:remove to remove all tasks;

-e:edit, edit, open a default editor for the current shell session to edit the cron task table;

Ctrl+d Submitting a task

Example: I write to/etc/crontab

1, every Monday to Saturday 3:20 A.M., run the CP command to archive the/etc/directory, storage location is/BACKUPS/ETC-YYYY-MM-DD;

3 * * 1-6 root/bin/cp-a/etc//backups/etc-' date +%f ' >/dev/null 2>&1

2, every Sunday 2:30 A.M., run the CP command to backup the/etc/fstab file, the storage location is/BACKUP/FSTAB-YYYY-MM-DD-HH-MM-SS;

3 * * 7 root/bin/cp-a/etc/fstab/backup/fstab-' Date +%y-%m-%d-%h-%m-%s ' >/dev/null 2>&1

3: Every night 12 o'clock, get all the lines in the/proc/meminfo file that begin with S or M, append to the/statistics/meminfo.txt file, and precede the daily message with a similar =============== separator line;

XX * * * root/bin/echo "===============================" >>/statistics/meminfo.txt &&/bin/cat/proc/m Eminfo | Egrep "^s|^m" >>/statistics/meminfo.txt >/dev/null 2>&1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/BA/wKioL1XsQOTiU3PnAAJOLTQpZeE462.jpg "title=" 8.png " alt= "Wkiol1xsqotiu3pnaajoltqpzee462.jpg"/>

Detailed usage of Task Scheduler (at, crontab) on Linux systems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.