at
at -f /usr/test_class/shell/read_date.sh 时间
# 查看计划任务
at -l
cron和crontab
* * * * * command
- - - - -
| | | | |
| | | | +---- 一周中的某天 (0 - 7) (Sunday=0 or 7)
| | | +------ 月份 (1 - 12)
| | +-------- 一个月中的某天 (1 - 31)
| +---------- 小时 (0 - 23)
+------------ 分钟 (0 - 59)
1)、实现步骤
# 创建定时任务--每周一的3点运行read_date.sh
vim cronjob
0 3 * * * 1 /usr/test_class/shell/read_date.sh
# 加载定时任务
crontab cronjob
read_lcoal_date.sh
#!/bin/bash
timedatectl | grep -E "Local" | grep -o ':.*\C' | sed 's/://;s/\C$//'