Common routine work on Linux

Source: Internet
Author: User
Common routine work in Linux 1. only one execution of a single job schedule is the operation of the at command! 1. atd startup and at operations: www.2cto.com [root @ localhost ~] #/Etc/init. d/atdrestartStopping...
Common routine work in Linux 1. only one execution of a single job schedule is the operation of the at command! 1. atd startup and at operations: www.2cto.com [root @ localhost ~] #/Etc/init. d/atd restartStopping atd: [OK] Starting atd: [OK]
2. set boot to start this service [root @ localhost ~] # Chkconfig atd on3. actually run the single job scheduling 1. after five minutes, send/root/. basrc to the root user [root @ localhost ~] # At now + 5 minutesat>/bin/mail root-s "testing at job" </root/. bashrc at> Press ctrl + d to display Job 7 at www.2cto.com [root @ localhost ~] # Atq worker query the number of at job scheduling tasks on the current host if atrm + job number 6 2012-09-25 a root7 2012-09-24 a root [root @ localhost ~] is disabled # At-c 6 #! /Bin/sh # atrun uid = 0 gid = 0 # mail root 0 2 list the above 5th items. if the command is as follows: [root @ localhost ~] # At 23:00 2012-9-25at>/bin/syncat>/bin/sync at>/sbin/shutdown-h nowat> Job 6 at www.2cto.com in fact, when we use at, the at shell environment allows users to execute work commands. you 'd better use the absolute path to execute 8. batch: the backend task is only executed when the system is free. it runs the task assigned only when the CPU workload is reduced to 0.8. [root @ localhost ~] # Batch 23:00 2012-9-25at> sync at> shutdown-h nowat> Press ctrl + d to display Job 8 at [root @ localhost ~] # Atq6 2012-09-25 a root8 2012-09-25 a root 2. the crontab command is used when you want to create a new circular job scheduling. However, for security issues, we can restrict the use of crontab user accounts, similar to. Restrictions are available.
1. user settings (1) are written to the account that can use crontab. if the account is not in this file,/etc/cron is unavailable. allow; www.2cto.com vi/etc/cron. allow, for example, I add root dg to these two users. note: Each user occupies a row [dg @ localhost ~] $ Crontab-eno crontab for dg-using an empty onecrontab: installing new crontab
(2) write accounts that cannot use crontab into the file. if the account is not recorded in this file, you can use/etc/cron. deny/etc/cron. deny, for example, add dg1 [root @ localhost ~] to it. # Useradd dg1 [dg1 @ localhost ~] $ Crontab-eYou (dg1) are not allowed to use this program (crontab) See crontab (1) for more information
By default, as long as it is not included in/etc/cron. in deny, you can directly execute crontab-e (3) and enter the following 0 12 *** mail dmtsai-s ""Run/home/dmtsai/test every 5 minutes. sh */5 ***/home/dmtsai/test. sh system configuration file:/etc/crontab [root @ localhost ~] # Cat/etc/crontabSHELL =/bin/bashPATH =/sbin:/bin:/usr/sbin: /usr/binMAILTO = rootHOME =/www.2cto.com # run-parts Time-Sharing day-month week executor command string 01 ***** root run-parts/etc/cron. hourly <-- 02 4 *** root run-parts/etc/cron every hour. daily: daily 22 4 ** 0 root run-parts/etc/cron. weekly -- 42 4 1 * root run-parts/etc/cron every week. monthly

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.