Command detailing the at and Crontab of Linux scheduled tasks and how to view crontab logs

Source: Internet
Author: User

One: 1. Planning a task is a task that performs the planned work at the agreed time, which is the surface meaning. In Linux, we often use cron servers to do this work. the cron Server can perform specific work based on the time specified in the configuration file. For example, we can contract in the configuration file every morning 4 points, the HTTPD server restart, this is a scheduled task;

2.Cron is a timed execution tool under Linux

Cron is a built-in service for Linux, but it does not automatically get up, and you can start and shut down this service in the following ways:

/sbin/service cronD start//start service

/sbin/service cronD stop//shutdown service

/sbin/service cronD restart//restart service

/sbin/service cronD reload//reload Configuration

3. Parameters:

-u: Only root can do this task, that is, to help other users new/delete crontab work schedule.

- E: Edit Crontab's work, a work line to edit.

- L: Check Crontab's job description,

- R: Delete all the contents of the crontab, if you want to delete only one item, please use-e to edit .

/etc/cron.allow will be able to use Crontab's account to write to it, if not in which the user cannot use it.

/etc/cron.deny will not be able to use the write in which, if not recorded in the inside can be used, preferential discrimination/etc/cron.allow But the default is only/etc/cron.deny

[email protected] log]# crontab-e

650) this.width=650; "width=" 423 "height=" 332 "src=" http://blog.itpub.net/attachment/201407/25/29654823_ 1406294330x6k4.jpg "/>

Minutes (0-59)

Hours (0-23)

Date (1-31)

Month (1-12)

Week (0-7)//0 7 for Sunday # Zhou cannot exist at the same time, otherwise syntax error.

Format: */3 * * * * ls # executed every three minutes,

2. Interactive command: At #要想使用at must have ATD this service [[email protected] ~]#/etc/init.d/atd Restart restart ATD Service,

[[Email protected] ~]# at 15:41 or [[email protected] ~]# at now + 1 minutes

At> CPLiuhezi/u01/app #at only once, notice that after the command is finished,in Ctrl+d ended.
At>
Job 4 at 2014-07-25 15:41
[[email protected]~]# Cd/u01/app
[[email protected]app]# ls into the/u01/app directory to find files that have not yet been copied because there's no time.
Oracle Orainventory
[[email protected]app]# Date
Fri Jul 15:40:39 CST 2014

[email protected] ~]# #到了时间 look at it already.

Liuhezi Oracle Orainventory

[email protected] ~]# ATQ #查看at工作调度

1 2014-07-26 15:19 a root
[email protected] ~]# ATRM 1 #删除at工作调度

[email protected] ~]# ATQ
(2) TheBatch command makes the system empty when the background task, he will be the CPU workload is less than 0.8, only when you want to perform your work tasks.

usage is similar to at user.

yesterday crontab in the synchronization task did not execute, do not know what reason is not executed, seemingly task Hang, want to inquire about crontab Where the problem is, or where the Hang is.
 1. Linux
See /var/log/cron This file can be, can use tail-f/var/log/cron observation
 2. Unix
in the /var/spool/cron/tmp file, there are croutXXX001864 tmp files, Tail These files, you can see the tasks that are being performed.
 3. Mail task
in  /VAR/SPOOL/MAIL/ROOT  crontab tail -f /var/spool/mail/ root  You can view the most recent crontab



This article is from the "Looking for Sunshine" blog, please make sure to keep this source http://shine.blog.51cto.com/365462/1917058

Command detailing the at and Crontab of Linux scheduled tasks and how to view crontab logs

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.