日期:2014-05-16  浏览次数:20709 次

linux下的crontab配置后怎么不能执行呢?
我的/etc/crontab的代码如下:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt
MAILTO=root
HOME=/

# *  *  *  *  * user-name command to be executed
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
03 * * * * root /opt/pro_some.sh

然后我的pro_some.sh的代码如下:

#!/bin/bash

ls >> result.txt

就这两行都不执行,我真的彻底无语了,这个shell程序是可以手动能够执行的。
所以不会有执行权限的问题。到底是怎么回事呢?
麻烦大家帮帮忙啊!!谢谢了!!!
Linux shell

------解决方案--------------------
pro_some.sh
改成
#!/bin/bash
 ls >> /home/result.txt

文件/命令 的路径最好都用绝对路径
------解决方案--------------------
引用:
Quote: 引用:

Quote: 引用:

Quote: 引用:

还有crond服务开了吗?
恩 我每次改crontab文件时都会restart的。

还是用crontab -e,在里面进行设置:
*/1 * * * * root /opt/pro_some.sh
一分钟来次,看看有没有?
太感谢您了,呵呵!我还想问一下 */1 跟 01这个有什么区别吗?

*/1是每分钟执行一次,
01就是每小时的零1分执行一次