Linux Timer tool-crontab specific explanations and how to view the log records

Source: Internet
Author: User
Tags tmp file rsyslog crontab syntax

To use the Crontab Timer tool, you must start the Cron service:

Service Cron Start

Crontab syntax for future emergencies. First on the Zhang Chao to force the diagram:




Crontab Each participant Description:

-E: Run text editor to edit crontab, the default text editor is VI

-R: Delete the crontab now

-L: List the current crontab (view private)

-I: will be used in conjunction with-R, ask when deleting the current crontab, and enter Y to delete

Note that Crontab is a sub-user, who will be edited to whom to log in crontab

Crontab Special Symbol Description:

"*" represents the total number of values within the range. Pay special attention to Oh!



"/" stands for every meaning, such as "*/5" means every 5 units

"-" represents a number to a number

"," scattered figures

Example of using the Crontab file:

30 21 * * * means 21:30 per night

45 4 1,10,22 * * = 4:45 per month for 1, 10, 22nd

10 1 * * 6,0 for every Saturday, Sunday 1:10

0,30 18-23 * * * means every 30 minutes from 18:00 to 23:00 daily

0 23 * 6 means every Saturday at 11:00am

* */1 * * * every hour

* 23-7/1 * * * 11 o'clock to 7 a.m., every hour.

* 8,13 * 1-5 from Monday to Friday 8 o'clock in the morning and 1 o'clock in the afternoon

0 4 * mon-wed monthly 4th and 11 points per Monday to Wednesday

0 4 1 Jan * 4 points on January 1


--------------------------------How to start the Crontab log service--------------------------------------------------------

Find out that Ubuntu does not have its own open Cron log service features, such as the following

The Cron log feature uses the SYSLOGD service, different versions of Linux may have different software, here are two common types:

Sysklogd>>>>>>

1. Edit/etc/syslog.conf. and open the line staring at the beginning of the cron.*.


2. Execute/etc/init.d/sysklogd restart.
3. Execute/etc/init.d/cron restart.

Rsyslog>>>>>>

1. Change the Rsyslog file. Delete the # before the #cron.* in the/etc/rsyslog.d/50-default.conf file;
2. Restart the Rsyslog Services service Rsyslog restart
3. Restart Cron Services Service cron restart


--------------------------------How to view crontab log records--------------------------------------------------------

The sync task in Crontab yesterday was not running. Do not know what the reason is not running, seemingly task hang, want to inquire about crontab exactly where the problem is, or hang in where.



1. Linux
Look/var/log/cron This file will be able to. Can be observed with tail-f/var/log/cron

2. Unix
In the/var/spool/cron/tmp file, there are croutXXX001864 tmp files, tail these files will be able to see the running tasks.

3. Mail Task
In the/var/spool/mail/root file, there is a record of crontab running log, tail-f/var/spool/mail/root can be used to view the recent crontab operation.

Linux Timer tool-crontab specific explanations and how to view the log records

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.