Linux crontab Scheduled Task collation

Source: Internet
Author: User

Linux Crontab Scheduled tasks to be organized and installed
yum install -y vixie-cron  # 安装
Common commands
crontab -e             # 编辑crontab -l             # 查看crontab -u             # 指定用户service crond start    # 启动service crond stop     # 关闭service crond restart  # 重启service crond reload   # 重载配置
Configuration
格式    * * * * *      分 时 日 月 星期(0-6)说明    * 所有取值范围内数字    / 每    - 某个数字 到 某个数字    , 分开几个离散的数字
Demo
*/5 * * * * php /home/www/test.php > /dev/null 2>&1
>/dev/null 2>&1 Analysis
标准输出重定向到空设备文件> 是重定向/dev/null 代表空设备文件1 表示stdout标准输出,系统默认值是1,所以 ">/dev/null" 等同于 "1>/dev/null"2 表示stderr标准错误& 表示等同于的意思,2>&1,表示2的输出重定向等同于1
Boot up
chkconfig --list crond # 是否开机启动查看添加开机启动    vi /etc/rc.d/rc.local    加 /sbin/service crond start
Crond cannot be restarted
    killall crond    crond restart
Crontab when the shell cannot execute

Shell in the head join Source/etc/profile

source /etc/profile#!/bin/bashcd /tmp/php test.php >> /tmp/test.log
Log location

Linux crontab Scheduled Task collation

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.