关于根据 crontab 添加一个 1分钟执行一次的命令 错误的执行和正确执行

关于根据 crontab  添加一个 1分钟执行一次的命令 错误的执行和正确执行

错误的执行一:

[www@localhost www]$ crontab -e -u www  * * * * *  php think  /www/index.php 
crontab: usage error: no arguments permitted after this option
usage: crontab [-u user] file
crontab [-u user] [ -e | -l | -r ]
(default operation is replace, per 1003.2)
-e     (edit user's crontab)
-l     (list user's crontab)
-r     (delete user's crontab)
-i     (prompt before deleting user's crontab)

正确执行:
[www@localhost www]$ crontab -e -u www

默认使用vi编辑器来设定时程表

* * * * *  php think  /www/index.php 

编辑好后,摁下ecs,:wq,保存退出;然后需要重启crond,重启需要root帐号

[www@localhost www]$ /sbin/service crond reload

Redirecting to /bin/systemctl reload crond.service

安装crontab:

yum install crontabs

服务操作说明:

/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

posted @ 2021-04-14 15:04  语不停  阅读(2682)  评论(0编辑  收藏  举报