shell脚本手动执行,但crontab 定时不能执行?????
建树 2009-07-29 07:33:17 shell脚本手动执行,但crontab 定时不能执行
#!/bin/bash
cd /arraydmapp/dmsystem/data/imeiinterface/interfaceout
count=`ls -l | wc -l`
if [ "$count" -gt 5 ]
then
cd /arraydmapp/dmsystem/exe/neucollect
neucollect stop & #程序重启 ,stop是neucollect的参数
sleep 10
neuconut=`ps -ef |grep neucollect| grep -v grep |grep -v restart.sh |wc -l`
if [ "$neuconut" -gt 0 ]
then
ps -ef |grep neucollect| grep -v grep | grep -v restart.sh > tempfile1
awk '{print $2 }' tempfile1 > tempfile2
{
for (( i=0; i< neuconut; i++))
do
read num
kill -9 $num
done
} < tempfile2
rm tempfile1 tempfile2
fi
neucollect start #程序重启 ,start是neucollect的参数。 neucollect是有C语言编译的程序
fi
请高手帮助,让这个程序定时也能正常执行。
~