Crontab routine work arrangement for Linux

Source: Internet
Author: User

Routine work arrangement for crontab in Linux

1. What is crontab?

Periodically process the daemons for to-do items, and the class dead task schedule.

2.crontab command resolution.

Example:

0 0 * * 1-5 cd/home/hiperry;/shutdwon.sh >/logs/shutdwon.log 2>&1

--Executes a custom shutdown script at 12 o'clock every night and writes log information to the specified log file.

Command resolution:

#----------------minutes (0-59)

# |-------------hours (0-23)

The day of the month of the----------(1-31)

# | | | |-------month (1-12) OR jan,feb,mar,apr ...

# | | | | |-----WEEK (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat

# | | | | |

* * * * * * * The command to be executed

> represents where to redirect, for example: echo "123" >/home/123.txt

1 indicates stdout standard output, the system default is 1, so ">/dev/null" is equivalent to "1>/dev/null"

2 indicates stderr standard error

& means equal to, 2>&1, indicating 2 output redirection equals 1

2>&1 indicates that all standard output and error output will be redirected to a file called Out.file

3.crontab Common operation

Listing crontab files: crontab-l

Edit crontab File: crontab-e

Delete crontab file: crontab-r

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.