最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

树梅派定时关机

运维笔记admin2浏览0评论

利用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
#

发布评论

评论列表(0)

  1. 暂无评论