???????? ?????????? ? ?????????? ? ?????? ???????

???????: Linux
???????, 20 ??? 2010 ?.
??????????: 5717
??????????? ?? ??????????? ?? RSS

? ???? ?????? ???????? ???, ??? ???????? ??????, ??????? ????????????? ??????????????? ?????????? ? ??????????.

???????? ???? ? ??????????, ?? ??????? ??? ?????? ??????? ????? ????????? ??????:

cd /etc/init.d
sudo touch check_internet

?????? ????? ????? ?? ??????:

sudo chmod +x check_internet

???????? ??????????????? ? ????????? ???????. ??????? gedit (?????? ??????? nano ??? ????? ??????? ??? ??? ????????? ????????):

sudo gedit check_install

????, ???? ?? ???????. ???????? ??????????????? ? ????????? ???????:

#!/bin/bash
#?????? ???? - ???? ? ??????????????. ? Ubuntu ? ?? ?????? ????????????? ?????? ???.
#??????? ??????????
DATE=$(date +%F)
#????????? ???? ? ?????, ? ??????? ????? ????????????, ? ????? ????? ?? ???? ????????? (????? ?????????? ??? ?????????? ;) )
path=/var/log
name=check_internet
log=$path/$name/$name.log
#??????? ????? ??????????.
cd $path
mkdir -p $name
#???? ???? ???? ?? ??? ??????, ?? ???????, ? ???? ???, ?? ???????? ?? ???? ?????????? ? ????????? ? ?????? ????. ???? ????? ??????? ?? ????.
if [ ! -e "$log" ]
then
    touch $log
else
    cat $log >> $log.$DATE
    rm -f $log
    touch $log
fi
while true
do
#???? ???? ????????, ?? ????????? ????????? (??? ????? ?????, ???? ????????? ?????? ?? ?????????)...
if eval "ping -c 1 www.google.com"; then
    echo "???????? ????????!"
#...? ???? ???, ?? ?????? ????? 10 ???, ????? ??? ???? (????? ????? ???????? ????????? ? ??????? ???)
else
    sleep 10
    if eval "ping -c 1 www.google.com"; then
        echo "???????? ????????!"
    else
#????????????? ???????? ??????????. ? ???? ?????????? xl2tpd, ??????? ? ? ???????????? ????????????? ?????. ? ????-?? ????? ?????? ??????????, ????????, ????? ???? "/etc/init.d/networks restart"
         /etc/init.d/xl2tpd restart
TIME=$(date +%D-%T)
        #??????? ? ???, ????? ??? ?????? ??????????
echo $TIME: ????????????????...>>$log
    fi
fi
#?????? ????? ? 60 ??? - ??? ????????????? ??????? ????? ????????? ??????
sleep 60
done

? ?????????? ??????? ?? ?????????. ?????? ???????? ??????? ????????? ?????? ??? ??????:

sudo gedit /etc/rc.local

????????? ????? "exit 0" ??????:

/etc/init.d/check_internet

??????! ???????? ????????????? ??????? ??? ??????? ????????? ??????:

sh /etc/init.d/check_internet

???????? ?????????

????????????: 5

  1. 2010-05-24 ? 15:27:31 | ?????????
    ]>]>

    ?????? ??????????? ?????????.

  2. 2010-06-06 ? 13:46:19 | Far East

    ????????? ?????????? ?????? ??? ????????????. ????? ????? ?? ?????? ????, ? ?? ? ?????????. ???? ? ????? ????? ???????.

  3. 2010-06-06 ? 14:01:14 | ?????????
    ]>]>

    Far East, ??????????? ?? ?????? ?????? ???????, ??, ???? ?? ???????????, ?? ???:

    ????????...

  4. 2010-06-06 ? 14:11:46 | Far East

    ???????. ????????? ??????? ? ?? ?????????. ?????? ????????.smile

  5. 2011-06-11 ? 15:11:58 | ??????????? 157
    ]>]>

    ?????????????? ????? ?????? ???????? ?? ????????? ????? ??????, ???????? ?????? ?? ????? ???? ??????, ???? ????? ???????? ??? ??????=((((

???????? ???????????!

?? ??????????????/??????

??????????? ?????????? ?????.

???? ?? ??? ???????????????? ??? ??????????? ??? ?????? ??????????????????, ??????? ?????? ? ???? ??????????? email.
(??? ??????????? ?? ????????? ????? ?????? ?????? ? ????? ????????? ? ??????? ?? ??? ???????????? ???????, ??? ?? ??????? ???????? ???? ??????, ??????? ????? ?????, ???, ????????, ???????? ? ?.?.)



grin LOL cheese smile wink smirk rolleyes confused surprised big surprise tongue laugh tongue rolleye tongue wink raspberry blank stare long face ohh grrr gulp oh oh downer red face sick shut eye hmmm mad angry zipper kiss shock cool smile cool smirk cool grin cool hmm cool mad cool cheese vampire snake excaim question

(???????????)