--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG-un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
Dear alok,
It'll send a mail for all hosts which are up or what .?
if yes then i'll get 10 mails in every second. cause * * * * incron
running this script.
so need a mail when host is donw and then again need a mail when that
one perticuler down host will gets up.
( if any mistake sorry )
But still problem is thr when ever any host is getting down it is
sending so many mails...i want to set like whenevr any host get down
just it send only one mail and when it gets up again it'll send mail
like host is up.. want to set this for 10 hosts.
how to set it please suggest.
thanks
On Dec 16, 10:38 pm, ElectroMech <electrom...@electromech.info> wrote:
> Hi,
>
I have made some changes to the script. Hope it may help you.
######################
#!/bin/bash
touch /tmp/host_down
for i in $(cat /tmp/host_down)
do
/bin/ping -c5 $i &> /dev/null
if [ $? = 0 ]; then
echo "$i is UP"| mail -s "$i is UP" a...@xyz.com
fi
done
cat /dev/null > /tmp/host_down
for n in 1 2 3
do
host=192.$n.0.1
/bin/ping -c5 $host &> /dev/null
if [ $? = 1 ]; then
echo "$host is DOWN"| mail -s "$host is DOWN" a...@xyz.com
echo $host >> /tmp/host_down
fi
done
############################
Best Regards,
Abhishek
> > 25, The Emperor, Fatehgunj, Baroda.www.electromech.info- Hide quoted text -
>
> - Show quoted text -
> > > 25, The Emperor, Fatehgunj, Baroda.www.electromech.info-Hide quoted text -
>
> > - Show quoted text -
Dear abhishek,
Thanks for replying
how it'll work not getting yaar.!! script is not working better now..
old one is working and sending mails when hosts are down but not
sending mails when they are up cause no settings in script( old
script).
Please help.
The script will create a file in /tmp/host_down which will retain the
servers which are down. In the first for loop it will check only those
servers which are down and if any of them is up then only it will send
the mail.
In the second for loop it is the usual logic that you are using only
exception is that it will add the failed servers in /tmp/host_down.
You can check the servers which are down in /tmp/host_down.
Best Regards,
Abhishek
> > > > 25, The Emperor, Fatehgunj, Baroda.www.electromech.info-Hidequoted text -
>
> > > - Show quoted text -
>
> Dear abhishek,
>
> Thanks for replying
>
> how it'll work not getting yaar.!! script is not working better now..
>
> old one is working and sending mails when hosts are down but not
> sending mails when they are up cause no settings in script( old
> script).
>
> Please help.- Hide quoted text -
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG-un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
On Dec 17, 3:41 pm, Abhishek <abhishekbose...@gmail.com> wrote:
> Hi Anil,
>
> I have made some changes to the script. Hope it may help you.
You are correct that your single line command will also work. But he
needs some thing which will only mail when some host is DOWN and again
when the host is UP. The command which you have given, it will mail
for all the servers whether it is DOWN or UP continuously whenever the
script runs. The script which I had made incorporates this facility.
Let me know if I am wrong.
Best Regards,
Abhishek
On Dec 18, 5:49 am, ElectroMech <electrom...@electromech.info> wrote:
> Hi
>
--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG-un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
> > Please readhttp://www.catb.org/~esr/faqs/smart-questions.html<http://www.catb.org/%7Eesr/faqs/smart-questions.html>before posting.
> > You received this message because you are subscribed to the "Vibrant
> > GNU/Linux User Group".
> > To stop receiving emails from this group, mail to
> > VGLUG-un...@googlegroups.com
> > To post to this group, send email to VG...@googlegroups.com
> > For more options, visit this group athttp://groups.google.com/group/VGLUG
>
> --
> The production of too many useful things results in too many useless people.
>
> With best regards,
> Nehal Dattani
Dear nehal Thanks a lot this script works..
can you pelase set the last one thing for me in this script.. when
host gets down it send's only 2 mails and again when that one host
get's up it'ss send 2 mails that host is up .
Now it is sending mails properly when host is down but it is sending
mails till host gets up so need 4 mails only when down and wen it
get's up.
Thanks