Commit a83de7cb authored by 苗青's avatar 苗青

rollback

parent 85139e3a
...@@ -48,30 +48,30 @@ if [[ $CLUSTER == "3B" ]]; then ...@@ -48,30 +48,30 @@ if [[ $CLUSTER == "3B" ]]; then
echo "tail -f $log_path/*log" echo "tail -f $log_path/*log"
tail -f $log_path/*log tail -f $log_path/*log
# 安装 crontab TODO apt or yum ## 安装 crontab TODO apt or yum
/bin/yum install -y crontabs #/bin/yum install -y crontabs
#
# 定时删除日志 ## 定时删除日志
deleteLogs() #deleteLogs()
{ #{
daysRetained='10' # daysRetained='10'
sysName=`cat /home/quant_group/build_info | grep 'SYSTEM_NAME' | awk -F: '{print $2}'` # sysName=`cat /home/quant_group/build_info | grep 'SYSTEM_NAME' | awk -F: '{print $2}'`
sysName='xyqb-user2' # sysName='xyqb-user2'
crontabCmd="0 1 * * * find "$log_path" -mtime +"$daysRetained" -name '"$sysName".log.*' -exec rm -rf {} \;" # crontabCmd="0 1 * * * find "$log_path" -mtime +"$daysRetained" -name '"$sysName".log.*' -exec rm -rf {} \;"
tmpCronFile='/tmp/crontab.bak' # tmpCronFile='/tmp/crontab.bak'
crontab -l &> $tmpCronFile # crontab -l &> $tmpCronFile
currentCrontab=`cat $tmpCronFile` # currentCrontab=`cat $tmpCronFile`
if [[ $currentCrontab == *"$crontabCmd"* ]] # if [[ $currentCrontab == *"$crontabCmd"* ]]
then # then
echo 'task already existed!' # echo 'task already existed!'
else # else
echo "$crontabCmd" >> $tmpCronFile # echo "$crontabCmd" >> $tmpCronFile
crontab $tmpCronFile # crontab $tmpCronFile
echo "add task to crontab!" # echo "add task to crontab!"
rm $tmpCronFile # rm $tmpCronFile
fi # fi
} #}
deleteLogs #deleteLogs
else else
echo "clean ${log_path}/*" echo "clean ${log_path}/*"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment