linux的crontab的一般用法

查看当前用户的crontab列表
crontab -l

添加或编辑命令
crontab -e

删除全部命令
crontab -r

系统全局配置文件,直接编辑可以更新全局命令
/etc/crontab

 

常用配置

系统开机执行命令
@reboot  systemctl start nginx

开机延迟执行
@reboot  (sleep 1 && systemctl start nginx)

如果要放全局配置文件crontab里要加root
@reboot  root  (sleep 1 && systemctl start nginx)

 

posted @ 2025-06-19 10:12  刘镇维  阅读(8)  评论(0)    收藏  举报