Initial commit

Signed-off-by: Qin Bo <bqin@linx-info.com>
This commit is contained in:
Qin Bo
2014-02-13 09:22:20 +08:00
commit 2235771f09
261 changed files with 34439 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
#!/bin/bash
unset cron
cron=$(ls /etc/rc.d/rc[0-9].d/*cron* 2> /dev/null)
if [ -z "$cron" ];then
ln -sf /etc/rc.d/init.d/cron /etc/rc.d/rc3.d/S520cron
ln -sf /etc/rc.d/init.d/cron /etc/rc.d/rc5.d/S520cron
else
for i in $cron
do
rm $i
done
ln -sf /etc/rc.d/init.d/cron /etc/rc.d/rc3.d/S520cron
ln -sf /etc/rc.d/init.d/cron /etc/rc.d/rc5.d/S520cron
fi
if [ -f /var/spool/cron/crontabs/root ];then
grep update_time.sh /var/spool/cron/crontabs/root &> /dev/null
if [ $? = 0 ];then
sed -i '/update_time.sh/d' /var/spool/cron/crontabs/root
echo "*/1 * * * * sysadmin /usr/sbin/update_time.sh" >> /etc/crontab
fi
else
grep update_time.sh /etc/crontab | grep sysadmin &> /dev/null
if [ $? != 0 ];then
echo "*/1 * * * * sysadmin /usr/sbin/update_time.sh" >> /etc/crontab
fi
fi
grep cron /etc/cron/weekly/syslog > /dev/null
if [ $? = 0 ];then
sed -i '/cron/d' /etc/cron/weekly/syslog
fi
#d5000 cron example
cp d5000_cron_example.sh /opt/
#logrotate
cp logrotate.d/* /etc/logrotate.d/
chown -R audadmin.audadmin /etc/logrotate.d/
#cp syslog /etc/cron/weekly/
/bin/rm /etc/cron/weekly/syslog
mkdir -p /etc/cron/monthly
cp syslog /etc/cron/monthly
chown -R audadmin.audadmin /etc/cron/monthly
setfacl -m u:sysadmin:rwx /usr/sbin/rotatelog
#delete
del_exist ()
{
if [ -f /etc/cron/daily/$1 ];then
/bin/rm /etc/cron/daily/$1
fi
}
del_exist makewhatis
del_exist pwck
del_exist rdate
del_exist slocate
#ntp client
if [ -f /usr/sbin/update_time.sh ];then
chmod +x /usr/sbin/update_time.sh
chown sysadmin:sysadmin /usr/sbin/update_time.sh
else
cat > /usr/sbin/update_time.sh << 'EOF'
#!/bin/bash
NTPSERVER_A=''
NTPSERVER_B=''
NTPDATE='/usr/sbin/ntpdate'
${NTPDATE} ${NTPSERVER_A} || ${NTPDATE} ${NTPSERVER_B}
hwclock -w
EOF
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
chmod +x /usr/sbin/update_time.sh
chown sysadmin:sysadmin /usr/sbin/update_time.sh
fi
#ntp server
sed -i '/ntps1*/d' /etc/ntp/ntp.conf
sed -i '/ntp1*/d' /etc/ntp/ntp.conf