-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
257 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 定时任务 crontab | ||
|
||
## 安装crontab | ||
|
||
一般centos安装了crontab | ||
|
||
```shell | ||
yum install crontabs | ||
``` | ||
|
||
## 查看运行状态 | ||
|
||
```shell | ||
systemctl status crond | ||
systemctl enable crond | ||
systemctl start crond | ||
``` | ||
|
||
## 查询定时任务列表 | ||
|
||
```shell | ||
crontab -l | ||
``` | ||
|
||
## 管理定时任务列表 | ||
|
||
实际上就是一个文件 | ||
|
||
```shell | ||
crontab -e | ||
|
||
0 19 * * * bash /root/test.sh | ||
``` | ||
|
||
## cron表达式 | ||
|
||
```text | ||
# .---------------- 分钟,取值范围为 0-59 | ||
# | .------------- 小时,取值范围为 0-23 | ||
# | | .---------- 日,取值范围为 1-31 | ||
# | | | .------- 月,取值范围为 1-12 | ||
# | | | | .---- 星期,取值范围为 0-7,0 和 7 都表示星期日 | ||
# | | | | | .-- 要执行的命令 | ||
# | | | | | | | ||
0 19 * * * bash /root/test.sh | ||
``` | ||
|
||
## 直接操作文件实现管理任务 | ||
|
||
```sh | ||
echo "*/10 * * * * "$base_path/change_images.sh >> /var/spool/cron/root | ||
``` | ||
|