得分
22
Advertisement
在这里我要说的是如何运行crontab工作。这对任何被crontab卡住的人都很有用。
*/1 * * * * cd /home/hacks && sh notify.sh
为了使脚本可执行,我们必须这样做:
chmod +x home/hacks/notify.sh
在这里,我每隔一分钟就运行这个脚本…… 通过执行下面的脚本,你可以把它写到一个日志文件中,以了解它是否工作
写日志
*/1 * * * * cd /home/hacks && sh notify.sh>>test.log
发送邮件
*/1 * * * * cd /home/hacks && sh notify.sh>>test.log | mail -s "Hi this is example" user@domain.com
``` 。