#!/bin/bash
ls -1 /var/spool/cron/| grep -v '^root'|while read u;
do
cat /var/spool/cron/${u}|\
awk '{print $1":"$2":"$3":"$4":"$5":"$NF}'|\
while read entry;
do
mn=$(echo ${entry}|awk -F':' '{print $1}');
if [[ ${mn} == "*" || ${mn} =~ "\*\/[0-14]$" ]];
then
echo "Minutely script found -> ${u}";
echo "Changing to normal"
indexsed=1
sed -i 's#^*[^ ][0-1][0-4]#*/15#'$indexsed /var/spool/cron/${u}
sed -i 's#^*[^ ][0-9] #*/15 #'$indexsed /var/spool/cron/${u}
sed -i 's#^[0-15] #*/15 #' /var/spool/cron/${u}
sed -i 's#^[:*:] #*/15 #' /var/spool/cron/${u}
fi;
done;
done
ls -1 /var/spool/cron/| grep -v '^root'|while read u;
do
cat /var/spool/cron/${u}|\
awk '{print $1":"$2":"$3":"$4":"$5":"$NF}'|\
while read entry;
do
mn=$(echo ${entry}|awk -F':' '{print $1}');
if [[ ${mn} == "*" || ${mn} =~ "\*\/[0-14]$" ]];
then
echo "Minutely script found -> ${u}";
echo "Changing to normal"
indexsed=1
sed -i 's#^*[^ ][0-1][0-4]#*/15#'$indexsed /var/spool/cron/${u}
sed -i 's#^*[^ ][0-9] #*/15 #'$indexsed /var/spool/cron/${u}
sed -i 's#^[0-15] #*/15 #' /var/spool/cron/${u}
sed -i 's#^[:*:] #*/15 #' /var/spool/cron/${u}
fi;
done;
done
Comments
Post a Comment