Crontab 补充指令

树莓派定时执行脚本

    树莓派定时执行脚本,可以通过如下指令,进入事件编辑功能

[html] view plain copy

  1. sudo crontab -e  


 
进入界面后,可以参考网上的一些文章,看其要求的格式

如:

   http://ju.outofmemory.cn/entry/68682

https://www.raspberrypi.org/documentation/linux/usage/cron.md

  编辑完毕后,很重要的一点是一定要执行如下命令

[html] view plain copy

  1. sudo /etc/init.d/cron restart  


否则,你的定时命令不会执行。

 

查看日志:

/var/log/syslog.1

 

1.sendmail.sh sendmail.py是否有可执行权限,如果没有的话执行下面命令:

chmod +x sendmail.sh/sendmail.py

2.sendmail.sh sendmail.py都要使用绝对路径。(这一点一定要注意,搞了一下午就栽在这上了)

   另外,就要看好,你的树莓派的时间跟自己的时间是否对上。可以通过如下指令查询

[html] view plain copy

  1. date  


 
至于配置时间或者同步时间,可以参考网络其他文章。

http://www.cnblogs.com/fengbohello/p/4181711.html

来自:http://blog.csdn.net/lan120576664

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注