Einzelnen Beitrag anzeigen
Alt 19.09.2005, 23:40   #2
colossus
Master
 
Registriert seit: 24.02.2002
Ort: Wien
Alter: 40
Beiträge: 611


Standard

Hab mal vor urzeiten (als mein Shellscript-Skill noch nicht allzu weit gediehen war ) etwas fuer inode unter Gentoo zusammengeschustert, das solltest du auch auf AON Complete anpassen koennen.

Code:
#/!bin/bash
CHKHOST="195.58.160.103" #Host to ping
CHKBEFORE="/usr/local/bin/inode-hangup" #program(s) to execute before restarting  initscripts, whitespace-seperated, absolute path!
CHKTORESTART="net.eth1" #init-script(s) to restart, whitespace-seperated, relative path!
CHKAFTER="/usr/local/bin/inode-dialin"

function testconn()
{
        ping -w5 -c1 ${CHKHOST} &> /dev/null;
        RESULT=${?};
        if [ ${RESULT} -gt 0 ];
                then echo -e "`date +\"%F %T\"` - Link seems down, Error ${RESULT}" && renew;
                #else echo -e "`date +\"%F %T\"` - Link seems up.";
                exit 0;
        fi;
}
function renew()
{
        if [ ${UID} = 0 ]; then
                echo "Trying to get link up again...";
                /usr/local/bin/inode-hangup &> /dev/null;
                for i in ${CHKTORESTART}; do
                        /etc/init.d/$i restart;
                done;
                /usr/local/bin/inode-dialin &> /dev/null;
        else
                echo 1>&2 -e "`date +\"%F %T\"` - Only root may renew this link!
";
                exit 1;
        fi;
}

testconn;
exit 0;
Das ganze in nen cronjob mit */1, und go.
____________________________________
Free Software. Free Society. Better Lives.
colossus ist offline   Mit Zitat antworten