基本问题是这样的.
我在root的目录里写了个tmp.sh
#!/bin/sh
cat /etc/passwd > /root/tt.txt
cat /etc/passwd | sed -e '10,12d' | sed -e '1,2d' >> /root/tmp.txt
我在root的目录下运行 sh ./tmp.sh 没有问题,tmp.txt里得到想要的东西了.但是我把它加到cron里就出事了.
cron里是这么写的
05 * * * * /bin/sh /root/tmp.sh
我把/root/tmp.txt 删除.但是用cron运行后,竟然没有产生tmp.txt,但是有tt.txt,说明tmp.sh运行了.
肯定就是最后一行有问题.
请大虾帮忙. |