admin管理员组

文章数量:1531759

利用crontab实现树梅派的定时关机

crontab(cron table 命令用于编辑执行中的定期任务列表,并且操作是基于每个用户的,每一个用户(包括 root 用户)都拥有自己的 crontab 。

命令:sudo nano /etc/crontab
编辑crontab在最后添加定时关机命令
编辑之后如下:
实现每天早上7:45关机

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
45 7    * * *   root    /sbin/shutdown -h now
#

本文标签: 定时关机树梅派