variablesDescriptionCrontab is used to allow the user to execute a program at a fixed time or at a fixed interval, in other words, a user-like schedule. -u user refers to the setting specifiedUser's time table, the premise is that you have to have permission (for example, root) to specify other people's schedule. If you do not use-u user, it means that you set theSet your own schedule.Parameters:CRONTAB-E: Execute the text editor to set the schedule,
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
Here are two ways to crontab.
First, use PHP to execute script in crontab
Just like calling a normal shell script in crontab (specific crontab usage), use a PHP program to invoke the PHP script.
Each hour executes myscript.php as
Delete a user's cron service configuration
-e Edit a user's cron service configuration, when specified crontab does not exist, new, will use VI to open the configuration file for editing save after the exit, file syntax see after
Crontab–v show The last edit time (available on some operating systems only)
Example: sudo
file and use crontab file to set the time table.InstanceRun the Command/bin/ls once every 0th minutes of every hour every month.0 7 ***/bin/lsDuring October 11, December, the/usr/bin/backup task is executed every 20 minutes from to every day.0 6-12/3*12 */usr/bin/backupFrom Monday to Friday, send a letter to alex@domain.name at every day0 17 ** 1-5 mail-s "hi" alex@domain.name Execute echo "
crontab command
Use
Submit, edit, list, or drop a cron job.Grammar
crontab[-e[username]|-l[username]|-r[username]|-v[username]| File]Describe
This crontab command submits, edits, lists, or drops cron jobs. A cron job is a command that is run by a cron daemon at the scheduled interval of a rule. To submit a cron job,
1.1/etc/crontab file
In the/etc directory there is a crontab file, where there are some scheduling programs running on the system. Each user can establish their own scheduling crontab.
Such as:
Copy Code code as follows:
[Root@dave ~]# Cat/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:
For details about how to use crontab in Ubuntu, ubuntucrontab
If a php script needs to be run at a specified time, such as regular website data statistics, automatic Database Backup tasks, and timed email sending.
If we do not use Cron to execute php scripts, we may use the php include method.
For example, add the code
Reference article: How to use the Crond command for Linux task scheduling process and considerationsI. Introduction of Crond ConceptThe concept of Crond and crontab is inseparable. Crontab is a command that is commonly used in Unix-and Unix-like operating systems to set instructions that are executed periodically. The command reads the instruction from the stand
Use Crontab to execute PHP code at regular intervals, with an example of every 10 minutes:
/10 * * * * wget-q--sqider http://******
first, use PHP to execute script in crontabJust like calling a normal shell script in crontab (specific crontab usage),
=roothome=/# for details see Mans 4 Crontabs# Example of Job definition:#.----------------Minute (0-59)# |.-------------Hour (0-23)# | |.----------DAY of Month (1-31)# | | |.-------month (1-12) OR jan,feb,mar,apr ...# | | | |.----DAY of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat# | | | | |# * * * * * * user-name command to be executed
Mailto=root: Is it that when the/etc/crontab in this file is wrong, the error message or the m
Before learning the crontab command, do you see any of the following scenarios:(1) The test server will generate a lot of junk files every day, manual daily to clean up very cumbersome, how to let the system automatically clean up on time?(2) How to collect the key information of the server regularly?With the crontab command, you can complete the timed execution of the script. Let's take a look at the usage
Use Crontab to execute PHP code at timed intervals, for example, every 10 minutes:
/10 * * * * wget-q--sqider http://******
First, use PHP to execute scripts in crontabJust like calling a normal shell script in crontab (specifically crontab usage),
The crond service is usually stored in/etc/init. d/crond, so that the crond service can be automatically started after the system starts.
Linux users use the crontab command to configure cron tasks.
Crontab contains cron. d, cron. daily, cron. Weekly, cron. Monthly, cron. Hourly five directories and crontab files u
). Running this line of command will not produce any output. Examples are as follows:
6 1 * Root tar czf/usr/local/backups/daily/etc.tar.gz/etc "/dev/null 2>1
Centos/freebsd the correct way to execute PHP program with Crontab is as follows:
Under Linux, you can use the Crontab+php method:
1. Use
crontab file, or displays the contents of the current user's crontab file if no user is specified. -R:Deletes a user's crontab file from the/var/spool/cron directory and, if no user is specified, deletes the current user's crontab file by default. -I: Give a confirmation prompt when deleting a user's
Use crontab to deploy scheduled tasks in Ubuntu
Using php to build a website, one of which can be used regularly every week. I want to see what methods I used to look at other people's things. There are generally two methods: one is a timing task provided by php and the other is carried by the system, crontab in Linux and scheduled tasks in Windows.
Previously, I
() and flush, later I read some related articles,
I have a deep understanding of the content. However, after the php scheduled task is enabled, it seems that the task cannot be stopped and the server does not need to be restarted. You cannot modify the PHP file.
Later I planned to use crontab in Linux. This time, we use Ubuntu to deploy the system and nginx as t
Original source: http://www.ccw.com.cn/htm/app/aprog/01_4_29_3.asp
Timed hot Backup (EXP) for an Oracle database can usually be implemented in two ways, using the Task Queue Manager (Job queue) that it provides in an Oracle database, and using the operating system's timed execution commands to do so. In the first method, the database is required to start the background process SNP, and the task queue's startup parameters are added to the Oracle initialization file, and the second me
LinuxVPS/use Crontab on the server to automate VPS
VPS or servers often require VPS or servers to regularly back up data, regularly restart a service, or regularly execute a program. Generally, Crontab is used in Linux, in Windows, scheduled tasks are used (Windows's Gui settings are relatively simple). The following describes how to install and
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.