27.11.2008 16:23
Код:
cd /home/oracle/
if ping arrakis.ah.ru -c1;
then

    if links -dump http://arrakis.ah.ru/portal/page/portal/internal/usefull/directory | grep "Internal Server Error";
    then
        if [ -f 'notworking' ]
        then exit;
        fi;
    rm working;
    echo > notworking;
    (
        sleep 1
        echo "ehlo x"
        sleep 1
        echo "mail from:olegon@ah.ru"
        sleep 1
        echo "rcpt to:01@ah.ru"
        sleep 1
        echo "data"
        sleep 1
        echo "subject:Portal is down..."
        sleep 1
        echo "from:olegon@ah.ru"
        sleep 1
        echo "to:01@ah.ru"
        sleep 1
        echo "Hello."
        sleep 1
        echo "This is a test message."
        sleep 1
        echo "Bye."
        sleep 1
        echo "."
        sleep 1
        echo "QUIT"
       ) | telnet mx.ah.ru 25;
    else
        if [ -f 'working' ]
        then exit;
        fi;
    rm notworking;
    echo > working;
    (
        sleep 1
        echo "ehlo x"
        sleep 1
        echo "mail from:olegon@ah.ru"
        sleep 1
        echo "rcpt to:oakulabuhov@ah.ru"
        sleep 1
        echo "data"
        sleep 1
        echo "subject:Portal is up..."
        sleep 1
        echo "from:olegon@ah.ru"
        sleep 1
        echo "to:oakulabuhov@ah.ru"
        sleep 1
        sleep 1
        echo "Hello."
        sleep 1
        echo "This is a test message."
        sleep 1
        echo "Bye."
        sleep 1
        echo "."
        sleep 1
        echo "QUIT"
        ) | telnet mx.ah.ru 25;
    fi;
else
        if [ -f 'notworking' ]
            then exit;
        fi;
    rm working;
    echo > notworking;
    (
        sleep 1
        echo "ehlo x"
        sleep 1
        echo "mail from:olegon@ah.ru"
        sleep 1
        echo "rcpt to:oakulabuhov@ah.ru"
        sleep 1
        echo "data"
        sleep 1
        echo "subject:Portal is down..."
        sleep 1
        echo "from:olegon@ah.ru"
        sleep 1
        echo "to:oakulabuhov@ah.ru"
        sleep 1
        sleep 1
        echo "Hello."
        sleep 1
        echo "This is a test message."
        sleep 1
        echo "Bye."
        sleep 1
        echo "."
        sleep 1
        echo "QUIT"
       ) | telnet mx.ah.ru 25;

fi;
07.09.2009 17:26
Немного видоизменил для проверки "живости" форума через крон:
Цитата:
#!/bin/bash
cd /home/ftp/exchange
if ping olegon.ru -c1 &>/dev/null;
then

if nice links -dump https://olegon.ru | grep "Powered by vBulletin" &>/dev/null;
then
if [ -f 'working' ]
then exit;
fi;
rm notworking &>/dev/null;
echo > working;
(
echo `date` -- olegon.ru is up >> /home/ftp/exchange/blocked_hosts;
echo "olegon.ru is up";
);
else
if [ -f 'notworking' ]
then exit;
fi;
rm working &>/dev/null;
echo > notworking;
(
echo `date` -- olegon.ru is down >> /home/ftp/exchange/blocked_hosts
echo "olegon.ru is down";
);
fi;
else
if [ -f 'notworking' ]
then exit;
fi;
rm working &>/dev/null;
echo >notworking;
(
echo `date` -- olegon.ru is down >> /home/ftp/exchange/blocked_hosts
echo "olegon.ru is down";
);

fi;

exit;
Часовой пояс GMT +3, время: 07:43.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.