September 5, 2015-after-school assignments

Source: Internet
Author: User

1. Summarize the detailed usage method of the task plan (at, crontab) on Linux system;

At command: A job that hosts a future run: supports the use of job queues: default to a queue; ctrl+dat [option] ... TIMETIME: (1) Absolute time hh:mm,mmdd[cc]yy, mm/dd/[cc]yy, dd.mm.[cc]yy or [Cc]yy-mm-ddtomorrow (2) Relative time now+ #UNITminute, hour, Day, week (3) Blur time Midnightnoonteatime common options:-Q queue:at job queue;-f/path/from/somefile: reads the job to run from the specified file;-l: View a list of such running jobs in the job queue ; the equivalent of using the ATQ command;-c At_job_num: Look at the contents of the running job;-D: Deletes the specified job; equivalent to ATRM
Crontab: Recurring Task Scheduler daemon: Crond recurring tasks are available in two categories: (1)   system cron task; No user identity is run by default, so you need to specify the additional runner;/etc/crontabvim command # example  OF JOB DEFINITION:#&NBSP:---------------- minute  (0 - 59) # |   .------------- hour  (0 - 23) # |  |  .---------- day  of month  (1 - 31) # |  |  |  .------- month   (1 - 12)  or jan,feb,mar,apr ...# |  |  |  |  &NBSP:---- day of week  (0 - 6)   (sunday=0 or 7)  or  sun,mon,tue,wed,thu,fri,sat# |  |  |  |  |# *   *  *  *  * user-name  command to be  Executed7 fields: Top 5 fields: Point in time user-name:  run a task as a user command to be executed:  to run a task (2)   User Cron Task: Submitted by a user, run as submitter by default, so no additional designation is required/var/spool/cron/usernamevim command; crontab command: Suggested # example of job definition:# .----- ----------- minute  (0 - 59) # |  .------------- hour  (0 -  23) # |  |  .---------- day of month  (1 - 31) #  |  |  | &nbsp.------- month  (1 - 12)  or jan,feb, mar,apr ...# |  |  |  | &nbsp.---- day of week   (0 - 6)   (sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat# |   |  |  |  |# *  *  *  *  *   command to be executed5 time points: minutes: Valid range of values 0-59; Hours: 0-23 days: January-3 January: 1-12 weeks: 0-7 Note: The number of months and weeks, Not recommended for simultaneous use; For example: 6 * * * * time notation:*:  A specific continuous time range for each time point within the valid value range of the time point;-: ,  3-7, : A discrete point in time,  3,5,7/#: How many times in the effective time range;At the specified frequency;1-30/4, */45 */3 * * * /bin/echo  "Howdy" 5 7 * *  1-5 /bin/echo  "Howdy" crontab command: Crontab [-u user] [-l | -r | -e]-u  user:  is not managing its own cron task, but the specified target user's cron task; root only has permissions to manage other users ' cron tasks; By default,-l: list, list tasks;-r:  remove,  remove All Tasks;-e: edit, edit, open a default editor for the current shell session to edit the cron task table;


2, 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 cp-rp/etc/backups/etc-' date +%y-%m-%d '

3, 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;

2 * * 0 cp/etc/fstab/backup/fstab-' date +%y-%m-%d-%h-%m-%s '

4, every night 12 o'clock, get all the lines in the/proc/meminfo file starting with S or M, appended to the/statistics/meminfo.txt file, and the daily message before, to add a similar =============== separator line;

0 * * * echo "=========================" >>/tmp/meminfo.txt | Egrep "^s|^m"/proc/meminfo >>/tmp/meminfo.txt


September 5, 2015-after-school assignments

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.