脚本一
#!/bin/bash
#cron_file='/home/zary/b';
cron_tmp='/home/zary/d';
cronpath="/home/zary/b";
cronbak='/home/zary/f';
parameter=;
if [ "$parameter" = "change" ]
then
cp $cronpath $cronbak;
sed -e '/c_check_mysqlstatus\.sh/s/^#//' -e '/c_check_webstatus\.sh/s/^#//' \
-e '/c_syscheck\.sh/s/#//' -e '/c_syscheck\.sh/s/^11/#11/' $cronpath >$cron_tmp;
cp $cron_tmp $cronpath;
crontab $cronpath;
elif [ "$parameter" = "resume" ]
then
sed -e '/c_check_webstatus\.sh/s/^/#/' -e '/c_check_mysqlstatus\.sh/s/^/#/' \
-e '/c_syscheck\.sh/s/^#//' -e '/c_syscheck\.sh/s/^\*\/20/#\*\/20/' $cronpath >$cron_tmp;
cp $cron_tmp $cronpath;
crontab $cronpath;
else
echo "Usage: c_startcron.sh [change/resume]";
fi
脚本二
#!/bin/bash
cronpath="/var/spool/cron/root";
if [ = 'tw' ]
then
kick="tw_mail.php";
elif [ = "nw" ]
then
kick="nw_mail.php";
elif [ = "pw" ]
then
kick="pw_mail.php";
fi
crontab -l|egrep -v "$kick">/tmp/crontab;
case "" in
daily)
date=" * * *";
;
weekly)
date=" * * 1";
;
monthly)
date=" * 1 *";
;
esac
cat /tmp/crontab > $cronpath;
if [ = "on" ]
then
echo "$date /usr/local/php5/bin/php /home/htdocs/pukicn/new/OM/Cron/$kick">>$cronpath;
fi
|
|
|