• cron(转) Anny


    From http://en.wikipedia.org/wiki/Cron

    cron is the time-based job scheduler in Unix-like computer operating systems. cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

    Cron is driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. Users can have their own individual crontab files and often there is a system wide crontab file (usually in /etc or a subdirectory of /etc) which only system administrators can edit.

    Each line of a crontab file represents a job and is composed of a CRON expression, followed by a shell command to execute.

    Example:

    The following line causes the user program test.pl – ostensibly a Perl script – to be run every two hours, namely at midnight, 2am, 4am, 6am, 8am, and so on:

    0 */2 * * *  /home/username/test.pl
    

    Predefined scheduling definitions

    There are several special predefined values which can be used to substitute the CRON expression.

    EntryDescriptionEquivalent To
    @yearly (or @annually) Run once a year, midnight, Jan. 1st 0 0 1 1 *
    @monthly Run once a month, midnight, first of month 0 0 1 * *
    @weekly Run once a week, midnight on Sunday 0 0 * * 0
    @daily Run once a day, midnight 0 0 * * *
    @hourly Run once an hour, beginning of hour 0 * * * *
    @reboot Run at startup  
    *    *    *    *    *  command to be executed
    ┬    ┬    ┬    ┬    ┬
    │    │    │    │    │
    │    │    │    │    │
    │    │    │    │    └───── day of week (0 - 6) (0 is Sunday, or use names)
    │    │    │    └────────── month (1 - 12)
    │    │    └─────────────── day of month (1 - 31)
    │    └──────────────────── hour (0 - 23)
    └───────────────────────── min (0 - 59)
    

    View crontab: crontab -l
    Edit crontab: crontab -e
  • 相关阅读:
    [IOS+PHP Jason格式的发送与解析]
    SQL查询排序某字段并选前N条数据
    [IOS Tableview] cell自定义view显示错误问题
    [IOS多线程]的使用:防止进行HTTP数据请求时,UI卡死。
    [IOS NSUserDefaults]的使用:登陆后不再显示登录界面。
    Rafy框架
    jmeter压测-负载配置
    定时任务的实现方式
    Storm学习笔记
    Java线程池的实现
  • 原文地址:https://www.cnblogs.com/limei/p/2582896.html
Copyright © 2020-2023  润新知