Commit 4cc77afc authored by 苗青's avatar 苗青

grep -v "no crontab"

parent 1d7d6c7a
...@@ -57,6 +57,7 @@ if [[ $CLUSTER == "3B" ]]; then ...@@ -57,6 +57,7 @@ if [[ $CLUSTER == "3B" ]]; then
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
cat $tmpCronFile | grep -v "no crontab" &> $tmpCronFile
currentCrontab=`cat $tmpCronFile` currentCrontab=`cat $tmpCronFile`
if [[ $currentCrontab == *"$crontabCmd"* ]] if [[ $currentCrontab == *"$crontabCmd"* ]]
then then
......
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