liunx 定时器

如何在linux系统中设置定时任务?

https://blog.csdn.net/qq_42102911/article/details/127123450

 

每天3点执行

0 3 * * * truncate -s 0 /home/fssc/nohup.out
0 3 * * * truncate -s 0 /usr/local/nginx/logs/access.log
0 3 * * * truncate -s 0 /usr/local/nginx/logs/error.log

crontab任务中的五个时间字段分别表示:

分钟(0-59)
小时(0-23)
日(1-31)
月(1-12)
星期(0-7,0和7都表示周日)

查看状态,启动

查看状态:systemctl status crond

开启命令:systemctl start crond        或者 service start crond

 

posted @ 2023-03-06 11:15  刘杨钊  阅读(12)  评论(0)    收藏  举报