导航

shell 小试牛刀 现学现卖

Posted on 2012-11-28 16:48  surealland  阅读(113)  评论(0编辑  收藏  举报

#!/bin/bash
export PATH="$PATH":/usr/local/bin
filepre="/data1/www/htdocs/xxx.xxx.xxx/system/"
filename=("sendbadge.php" "sendcache.php" "sendmail.php" "sendnotice.php" "sendweibo.php")
logname=("testsendbadge.log" "testsendcache.log" "testsendmail.log" "testsendnotice.log" "testsendweibo.log")
count=${#filename[@]}
i=0
for((i=0;i<"$count";i++))
do
filephp=${filepre}${filename[i]}
filelog=/tmp/${logname[i]}
if test $( pgrep -f "php ${filephp}" | wc -l )
then nohup php ${filephp} >> ${filelog} &
fi
done