好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

centos自动命令 - Linux操作系统:Ubuntu_Centos_Debian

centos自动命令

 

yum install crontabs

  www.2cto.com  

说明:

/sbin/service crond start //启动服务

/sbin/service crond stop //关闭服务

/sbin/service crond restart //重启服务

/sbin/service crond reload //重新载入配置

 

查看crontab服务状态:service crond status

 

手动启动crontab服务:service crond start

 

查看crontab服务是否已设置为开机启动,执行命令:ntsysv

 

加入开机自动启动:

chkconfig –level 35 crond on

  www.2cto.com  

1,crontab命令

 

功能说明:设置计时器。

 

语  法:crontab [-u <用户名称>][配置文件] 或 crontab [-u <用户名称>][-elr]

 

补充说明:cron是一个常驻服务,它提供计时器的功能,让用户在特定的时间得以执行预设的指令或程序。只要用户会编辑计时器的配置文件,就可以使 用计时器的功能。其配置文件格式如下:

Minute Hour Day Month DayOFWeek Command

 

参  数:

-e  编辑该用户的计时器设置。

-l  列出该用户的计时器设置。

-r  删除该用户的计时器设置。

-u<用户名称>  指定要设定计时器的用户名称。

 

2,crontab 格式

  www.2cto.com  

基本格式 :

* *  *  *  *  command

分 时 日 月 周  命令

 

第1列表示分钟1~59 每分钟用*或者 */1表示

第2列表示小时1~23(0表示0点)

第5列标识号星期0~6(0表示星期天)

第6列要运行的命令

 

# Use the hash sign to prefix a comment

# +—————- minute (0 – 59)

# | +————- hour (0 – 23)

# | | +———- day of month (1 – 31)

# | | | +——- month (1 – 12)

# | | | | +—- day of week (0 – 7) (Sunday=0 or 7)

# | | | | |

# * * * * * command to be executed

 

查看更多关于centos自动命令 - Linux操作系统:Ubuntu_Centos_Debian的详细内容...

  阅读:58次