Post by Maciej MilaszewskiWitam
No ciekawe ciekawe :) maz moze jakiegos prostego confa o tego itp ? Bo
bym sobie z checia potestowal a ostatnio mam malo czasu zeby zaglebiac
sie teraz w dokumentacje itp.
Do tego nie mam konfa - opcje idą z lini komend. Ale jeżeli cię to
interesuje to poniżej masz skrypt który do tego wykorzystuję. P.S.Czy
"PAN" potrafi załączyć plik do postu na grupie?
P.P.S.Dalej nie zawijam wierszy, żeby się łatwiej czytało.
glpi:/usr/local/mondo# glpi:/usr/local/mondo# cat mondo.sh
#!/bin/sh
#
# Made by LeadMan 2006
#
# Stopping servers, to avoid corrupting of database,etc:
clear
for service in snmpd vsftpd apache2 mysql exim4 inetd apcupsd
do
echo '[mondo.sh '`date "+%F %T"`'] Stopping '$service' service.' > /var/log/mondo.sh.log
service $service stop
service_exit_status=$?
sleep 8
counter=0
while [ $counter -lt 3 ]
do
sleep 12
ps ax | grep $service | grep -v grep
if [ $? -eq 0 ]
then
echo '[mondo.sh '`date "+%F %T"`'] Failed stopping '$service' service (service returned status '$service_exit_status'), trying again...' >> /var/log/mondo.sh.log
counter=$[ counter + 1 ]
service $service stop
else
echo '[mondo.sh '`date "+%F %T"`'] Service '$service' stopped.' >> /var/log/mondo.sh.log
counter=3
fi
done
done
# Making backup:
mondoarchive -ONFre9 -p glpi -d /dev/cdrom -s 4380m 2>&1 >> /var/log/mondo.sh.log
if [ $? -eq 0 ]
then
echo '[mondo.sh '`date "+%F %T"`'] DVD backup succedded.(?) Insert new blank DVD.' >> /var/log/mondo.sh.log
eject
else
echo '[mondo.sh '`date "+%F %T"`'] DVD backup FAILED.' >> /var/log/mondo.sh.log
# Place for some function that would notify admin by sms/mail/etc
fi
# Starting servers
for service in apcupsd inetd exim4 mysql apache2 vsftpd snmpd
do
echo '[mondo.sh '`date "+%F %T"`'] Starting '$service' service.' >> /var/log/mondo.sh.log
service $service start
service_exit_status=$?
sleep 8
counter=0
while [ $counter -lt 3 ]
do
sleep 12
ps ax | grep $service | grep -v grep
if [ $? -ne 0 ]
then
echo '[mondo.sh '`date "+%F %T"`'] Failed starting '$service' service (service returned status '$service_exit_status'), trying again...' >> /var/log/mondo.sh.log
counter=$[ counter + 1 ]
service $service start
else
echo '[mondo.sh '`date "+%F %T"`'] Service '$service' started.' >> /var/log/mondo.sh.log
counter=3
fi
done
done
exit 0
--
Kind Regards, Patryk Benderz, Linux Registered User #377521
"...if something can go wrong, it will, except of a prototype, where if
it can go right, it will..." - Engineer's Law.