天天看點

ubuntu cron 及 crontab 自動執行任務

Add the below line (with tweaks) to the end of

/etc/crontab

:

30 23 * * * root shutdown -h now
           

At 23:30 (11:30 PM), the kiosk will shut down. No matter what user is logged in, the shutdown command runs as root.

(If you don't want to use the global crontab, log in as root and use

crontab -e

. Use the same above syntax without the

root

).

Cron Format:

MM HH DD OO WW command
           

MM

: Minute, 0-59

HH

: 24-hour hour

DD

: Day of month

OO

: Month

WW

: Day of Week (Sunday is 0, Monday is 1)

command

: Self-explanatory

如在22:00自動關機:

00 22   * * *   root    shutdown -h now      

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

微信公衆号:  共鳴圈

歡迎讨論,郵件:  924948$qq.com       請把$改成@

QQ群:263132197

QQ:    924948

良辰美景補天漏,風雨雷電洗地塵

繼續閱讀