Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../sbin/clear-maintenance
Real path: /usr/sbin/clear-maintenance
Zurück
#!/bin/sh # # check_maintenance - prueft ob ein Dienst im maintenance Mode ist, wenn ja # automatisch clear und restart # # JPB, PK # Donnerstag, 7. August 2014 09:56:48 Uhr MEST # Mon Dec 8 15:44:29 MET 2014 # # # Mailadressat im Fehlerfall MUSER="rbg root" GAWK=/opt/csw/bin/gawk if [ ! -x $GAWK ] ; then GAWK=/usr/bin/gawk fi if [ ! -x $GAWK ] ; then echo "$GAWK existiert nicht!!!" exit fi PID=$$ PIDFILE=/var/run/check-maintenance.pid interrupt() { echo "check-maintenance: abgebrochen" rm -f $PIDFILE exit 3 } trap interrupt 1 2 3 4 5 6 7 8 10 12 13 14 15 if [ $# -eq 1 -a "$1" = "-f" ] ; then rm -f $PIDFILE fi if [ -f $PIDFILE ] ; then echo "check-maintenance: laeuft noch" exit 1 fi echo $PID >$PIDFILE MAINT=`/usr/bin/svcs -a | $GAWK '/maintenance/{ print $3 }'` if [ "x$MAINT" != "x" ] ; then for DIENST in $MAINT do echo $DIENST /usr/bin/svcs -p $DIENST sleep 3 RES2=`/usr/bin/svcs -p $DIENST | $GAWK '/maintenance/{ print $1 }'` if [ "x$RES2" != "xmaintenance" ] ; then echo "neuer Zustand nach 3 Sekunden, erstmal nichts machen" /usr/bin/svcs -p $DIENST continue fi echo jetzt wirklich was tun echo svcadm clear $DIENST /usr/sbin/svcadm clear $DIENST sleep 6 RES3=`/usr/bin/svcs -p $DIENST | $GAWK '/maintenance/{ print $1 }'` if [ "x$RES3" != "xmaintenance" ] ; then echo "neuer Zustand nach 6 Sekunden, erstmal nichts machen" ## echo /etc/ipf/restipf ## /etc/ipf/restipf /usr/bin/svcs -p $DIENST continue fi ## echo /etc/ipf/restipf ## /etc/ipf/restipf /usr/bin/svcs -p $DIENST /usr/bin/mailx -s check-svcs-maintenance $MUSER <<EOF /usr/sbin/clear-maintenance /usr/sbin/svcadm clear $DIENST ## /etc/ipf/restipf Ergebnis: /usr/bin/svcs -p $DIENST `/usr/bin/svcs -p $DIENST` EOF done fi /usr/sbin/check-smf -s if [ $? -ne 0 ] ; then /usr/bin/date >tmp/check-smf.prot /usr/sbin/check-smf >>/tmp/check-smf.prot 2>&1 cat /tmp/check-smf.prot /usr/bin/mailx -s check-smf $MUSER </tmp/check-smf.prot fi rm -f $PIDFILE