#/bin/bash
# @author: youge
# @date: 2015-12-22
startDate="2015-11-24" # when to start
startDateTimestamp=`date -d "$startDate" +%s`
endDate="2015-12-14" # when to end
endDateTimestamp=`date -d "$endDate" +%s`
sleepTime=25 # to take a break
haveSthUndo=0 # check if there is something undo , if not , exit the program
rootDir='/cygdrive/d/wamp/ppi/'
dir=$rootDir"cron/"
itemArr=("itemA" "itemB" "itemC") # the items you want to run there
for item in ${itemArr[@]}
do
runFile=$rootDir$item".run";
if [ ! -f "$runFile" ] ; then
haveSthUndo=1;
echo $item" runs on me" $runFile " touched";
echo -e "script startTime: "`date "+%Y-%m-%d %H:%M:%S"` "\nbeginDate:" $startDate "\nendDate:" $endDate "\npath:" $dir >> $runFile
touch "$runFile";
break;
else
echo $item "is runing, skipped. " $runFile;
fi
done;
if [ $haveSthUndo -ne 1 ]; then
echo -e "Nothing to do now ...\ncheck it...";
exit;
fi
echo "haveSthUndo eq: " $haveSthUndo;
while [[ $endDateTimestamp -ge $startDateTimestamp ]]
do
runDate=`date -d @$startDateTimestamp +%Y-%m-%d`; #1987-01-06
params="item=$item&d=$runDate";
msg="[`date "+%Y-%m-%d %H:%M:%S"`] now we run the date: "${runDate}" [params]: "${params};
echo $msg; # to show me ...
echo $msg >> $runFile;
# run the scripts below
cd $dir &&
/bin/php ./script1.php $params &&
/bin/php ./script2.php $params &&
/bin/php ./scriptx.php $params
# run the scripts upon
startDateTimestamp=`expr $startDateTimestamp + 86400`; # run the next day ...
echo " ___sleeping for $sleepTime seconds ... ";
x='';
for ((itime=0; itime<$sleepTime; itime++)); do
let itime2=$itime+1;
progress=`expr $itime2 \* 100 / $sleepTime`;
printf "cooling:[%-"$sleepTime"s]%d%%\r" $x $progress
x=#$x
sleep 1; # sleep xx seconds to run the next time, show the progress
done;
echo;
done;
echo "[`date "+%Y-%m-%d %H:%M:%S"`] the end." >> $runFile;
#end of the file
[ root @my-pc ]$ sh urScripts.sh #see you next time
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有