- 论坛徽章:
- 0
|
while true;do //主循环
if [ `ls /home/jealt/autofetion|wc -l` -gt 0 ] && [ ! -f /home/jealt/stop.flg ]; //检测指定文件夹下是否存在文件&&是否存在停止标志
then
for i in `ls /home/jealt/autofetion` //取指定文件夹下所有文件名赋值给i
{
/home/jealt/sendsms/sendsms -vlf 'Fetion No.' -p 'Password' -t `head -n 1 /home/jealt/autofetion/$i` `tail -n +2 /home/jealt/autofetion/$i` //用sendsms发送飞信,文件夹下的文件格式均为第一行是接收人的飞信号,第二行之下都是短信内容
rm -f /home/jealt/autofetion/$i //删掉已发送的文件
}
elif [ -f /home/jealt/stop.flg ]; //如果存在停止标志,就退出循环
then
rm -f /home/jealt/stop.flg //删除停止标志,避免下次运行依然退出
break
fi
sleep 600 //休眠10分钟,继续循环
done
while true ; do //主循环
if [ -f /home/jealt/sale.txt ] && [ !-f /home/jealt/stop.flg ]; //检测是否存在指定文件和停止标志
then
/home/jealt/sendsms/sendsms -vlf 'Fetion No.' -p 'Password' -t `awk '$1==1{print $2}' fetion_no|paste -d"," -s` < sale.txt //将指定文件内容发给fetion_no文件中第一列值为1的对应飞信号
date +%m%d%H%M >> /home/jealt/sendsms.log
echo "Sms sent!" >> /home/jealt/sendsms.log //写入日志
rm -f sale.txt
elif [ -f /home/jealt/stop.flg ];then
rm -f /home/jealt/stop.flg
break
fi
sleep 600
done
date +%m%d%H%M >> /home/jealt/sendsms.log
echo "Stop proc now!" >> /home/jealt/sendsms.log //写入日志
[ 本帖最后由 jealt 于 2009-7-29 08:31 编辑 ] |
|