1. crontabIntroduction
The crontab command schedules the execution of some commands at certain intervals.
1.1/etc/crontab file
There is a crontab file in the/etc directory, which stores some scheduling tasks that are running systematically.Program. Each user can create their own scheduling crontab.
For
Crontab Scheduled Task configuration record, crontab task
First, preface
Today, simply record the configuration of the crontab
Ii. Catalogue of Crontab
/etc/crontab file This is the scheduled task for the system to run/var/spool/cron directory user-defined
Statement: This article reproduced from: http://www.taoyutaole.com/thread-1436-1-3.html
How to Use crontab in Linux, and how to use crontab.
As a website O M engineer, you often have to deal with crontab. You can use crontab to automatically run scheduled tasks to achieve automated O M. In my daily work, I also deep
Http://hi.baidu.com/totorol/blog/item/8349643187099d1debc4af8f.html
Crontab command
The crontab command is used to install, delete, or list tables used to drive cron background processes. That is to say, the user puts the command sequence to be executed into the crontab file for execution. Each user can have their own crontab
Crond start it, cron service is a scheduled service, you can add or edit tasks that need to be performed on a timed basis through the crontab command.When used, several auxiliary characters are used, which are described as follows:
*
stands for any match, for example" * * * */bin/execute/this/script.sh "stands for: every minute, every hour, daily,
Crontab: scheduled task execution. Crontab: scheduled task execution.
I recently came into contact with the needs of scheduled execution programs, so I learned about crontab. This article first introduces the syntax knowledge of crontab, and then makes a demo.
I. crontab syn
execute the command inside. Therefore, the Cron service does not need to be restarted after this file has been modified.2. Edit/etc/crontab File Configuration cronCron service every minute not only to read all the files within/var/spool/cron, but also to read a/etc/crontab, so we configure this file can also use the Cron service to do something. The crontab conf
Linux: Crontab scheduled Task Command details 1. Crontab introduces the function of crontab command to schedule the execution of some commands at a certain interval. The 1.1/etc/crontab file has a crontab file under the/etc directory, which stores some scheduling programs th
crontab configuration is for a user, while the edit/etc/crontab is a task for the system. The file format for this file is:
1234567891011
Shell=/bin/bashpath=/sbin:/bin:/usr/sbin:/usr/bin //environment variable Mailto=root //If an error occurs, or if there is data output, the data is sent to this account as an email home= /// user Run path, here is the root directory #
run-parts/etc/cron.monthly//monthly to execute/etc/cron.monthly script
Attention to the "run-parts" This parameter, if you remove this parameter, then you can write a script to run the name, not the folder name.
[Example 8]
5,15,25,35,45,55 16,17,18 * * * command
This means that any day any month, in fact, every day 4 o'clock in the afternoon, 5, 6 points 5 min, min, min, min, Min, and Min, the implementation of the command.
[Example 9]
data is sent to this account as an email.Home = // path of the user running. The root directory is used here.# Run-Parts01 *** root run-parts/etc/cron. Hourly // execute the script in/etc/cron. Hourly every hour02 4 *** root run-parts/etc/cron. daily // run the script in/etc/cron. daily every day.22 4 ** 0 root run-parts/etc/cron. Weekly // execute the script in/etc/cron. Weekly every week42 4 1 ** root run-parts/etc/cron. Monthly // run the script i
"Global (System) configuration file"/etc/crontabLinux main configuration files are in the ETC directory.CD/etcls cron*Vim crontabAccess to CRON.D (service)CD CRON.DUse the cat command to view the Sysstat file (the Cat command is a text output command under Linux, usually for viewing the contents of a file)Cat SysstatYou'll find that the content looks similar to what you crontab-l.When the crontab loads the
the/etc/crontab file.
The cron service not only reads all files in/var/spool/cron every minute, but also reads/etc/crontab once. Therefore, we can use the cron service to configure this file. Crontab configuration is intended for a user, and editing/etc/crontab is a system task. The file format of this file is:
Sh
Writing a scheduled task is like CRONTAB-E, but what's the difference between this and direct Vim/etc/crontab? Why did you finish the planning task,/etc/crontab?Method 1: Use the command crontab-e and edit the timed script directly. After this execution, the user-defined, will be written to the/var/spool/cron directory
logs.There is a crontab file in the/etc directory, which is the configuration file for system task scheduling..
The/etc/crontab file contains the following lines:
[Root @ localhost ~] #Cat/etc/crontab
SHELL =/bin/bash
PATH =/sbin:/bin:/usr/sbin:/usr/bin
MAILTO = "" HOME =/
# Run-parts
51 * root run-parts/etc/cron. hourly
24 7 * root run-parts/etc/cron. daily
22
. The interval frequency value can also be used with asterisks. For example, the value of */3 can be used in the month field to indicate that the task runs every three months.The line starting with the pound sign (#) is a comment and will not be processed.As you can see in the/etc/crontab file, it uses the Run-parts script to perform/etc/cron.hourly,/etc/cron.daily,/etc/cron.weekly, and/etc/cron.monthly Scripts in the directory that are executed hourl
Linux-crontab and linux-crontab
I have learned a little about crontab before, And I am familiar with it some time ago. I will record it today.
Crontab commands are common in Unix and Unix-like operating systems and are used to set periodically executed commands. This command reads commands from the standard input devic
. the root directory is used here.
# Run-parts
01 *** root run-parts/etc/cron. hourly // execute the script in/etc/cron. hourly every hour
02 4 *** root run-parts/etc/cron. daily // run the script in/etc/cron. daily every day.
22 4 ** 0 root run-parts/etc/cron. weekly // execute the script in/etc/cron. weekly every week
42 4 1 ** root run-parts/etc/cron. monthly // run the script in/etc/cron. monthly every
month, which can be any integer from 1 to 12.L Week: Represents the day of the week, which can be any integer from 0 to 7, where 0 or 7 represents Sunday.L Command: The commands to execute can be system commands or script files that you write yourself.In each of these fields, you can also use the following special characters:L asterisk (*): represents all possible values, such as the month field if it is an asterisk, the command action is executed monthly
Crontab command backup log, crontab command logCrontab command to back up logs
Question
James is a server administrator who needs to back up Forum data every day (Here we use logs to replace), back up the logs of the day and delete the previous logs. The file name after the backup is in the format of year-month-day. Alternatives. log is under/var/log.
Target
1. Add scheduled tasks for shiyanlou users2. Regu
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.