linux
主页 > 服务器 > linux >

linux设置定时任务的教程

2024-08-19 | 佚名 | 点击:

linux设置定时任务执行定时脚本

系统定时任务周期:每小时

控制定时任务目录:

/etc/cron.hourly

定时 每小时顺序:

1

[root@localhost ~]# cd /etc/cron.hourly

1

[root@localhost cron.hourly]# touch 1.sh

1

[root@localhost cron.hourly]# chmod +x 1.sh

系统定时任务周期:每一天

控制定时任务目录:

/etc/cron.daily

1

[root@localhost ~]# cd /etc/cron.daily

1

[root@localhost cron.hourly]# touch 1.sh

1

[root@localhost cron.hourly]# chmod +x 1.sh

系统定时任务周期:每一周

控制定时任务目录:

/etc/cron.weekly

1

[root@localhost ~]# cd /etc/cron.weekly

1

[root@localhost cron.hourly]# touch 1.sh

1

[root@localhost cron.hourly]# chmod +x 1.sh

系统定时任务周期:每个月

控制定时任务目录:

/etc/cron.monthly

1

[root@localhost ~]# cd /etc/cron.monthly

1

[root@localhost cron.hourly]# touch 1.sh

1

[root@localhost cron.hourly]# chmod +x 1.sh

设置执行时间

1

vi /etc/crontab

1

00 3 * * * root run-parts /etc/cron.daily

原文链接:
相关文章
最新更新