注意: crontab執行時間與用date命令顯示出時間不一致, 很有可以能是沒有重啟服務導致的.
-
查看系統時間
vagrant@homestead:~$ timedatectl status Local time: Fri 2019-06-28 09:48:56 CST #本地時間 Universal time: Fri 2019-06-28 01:48:56 UTC RTC time: Fri 2019-06-28 01:48:57 #硬件時間 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no
-
刪除和修改時區
rm /etc/localtime && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
-
* 重啟服務
service crond restart
- 測試crontab執行時間是否與Local time 一致
