# m h dom mon dow command
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └─day of week(0-7)(0 to 6 are Sunday to Saturday,or use names;7 is Sunday,the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
使用方法:进入root用户:
输入:
crontab -e在文件尾添加:
*/20 * * * * /etc/network/if-down.d/net_restart.sh
0 17 */1 * * /etc/network/if-down.d/net_reboot.sh
表示每20分钟执行一次net_restart.sh脚本,检查网络是否连通。每天的17:00执行net_reboot.sh,如网络断开则重启一次树莓派。
网友评论