这个脚步是判断aimeserverd.nginx是否启动成功,如果失败等60秒重新启动,最多试10次。
/etc/init.d/aimeserverd.nginx start >> result.${date}
returnaimestat=$?
aim_num=0
while [ $aim_num -lt 10 ]
do
if [ $returnaimestat -ne 0 ]
then
sleep 60
/etc/init.d/aimeserverd.nginx start >> result.${date}
returnaimestat=$?
echo "aimeserverd stat $returnaimestat">>result.${date}
else
break
fi
let aim_num+=1
done
脚本二
放后台下载,最多只能运行50个下载进程。
#!/bin/bash
cd /mnt/mediadisk2
for i in `seq 8 |awk '{printf "0%d\n",$0}'`
do
cd /mnt/mediadisk2/$i
for file in `cat /mnt/mediadisk2/$i.txt`
do
wget $file > /dev/null 2>&1 &
if [ $? -eq 0 ]
then
echo "$file is ok" >> /mnt/mediadisk2/$i.log
pscount=$(ps -ef |grep -v "grep" | grep -c wget)
until [ $pscount -le 50 ]
do
sleep 2
pscount=$(ps -ef |grep -v "grep" | grep -c wget)
done
done
done
阅读(3079) | 评论(1) | 转发(0) |