Computing.Net > Forums > Solaris > Ping LDAP Server from Script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Ping LDAP Server from Script

Reply to Message Icon

Name: Sujan (by Sujan Banerjee)
Date: February 16, 2009 at 03:17:21 Pacific
OS: Solaris 5.8
CPU/Ram: 2GB
Product: Sun sparc / Sparc 9
Subcategory: General
Comment:

Dear Friends,

I want to Ping LDAP Server(say 10.10.10.112) from a Script, store the data in a file and then grep last 2-3lines from that file to know LDAP Response.Last 2-3 Lines are normally:-
"4 packets transmitted, 4 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/0
"
So it gives a fair idea of LDAP Response.
Here is a small Script and its output:-
----------
bash-2.03# cat pingserver.sh
#!/bin/ksh
ping -s 10.10.10.112 &
sleep 5
pkill -f ping


bash-2.03# sh pingserver.sh
PING 10.10.10.112: 56 data bytes
64 bytes from mllndata (10.10.10.112): icmp_seq=0. time=0. ms
64 bytes from mllndata (10.10.10.112): icmp_seq=1. time=0. ms
64 bytes from mllndata (10.10.10.112): icmp_seq=2. time=0. ms
64 bytes from mllndata (10.10.10.112): icmp_seq=3. time=0. ms
64 bytes from mllndata (10.10.10.112): icmp_seq=4. time=0. ms
64 bytes from mllndata (10.10.10.112): icmp_seq=5. time=0. ms
24534 Terminated
bash-2.03#
-----------
Here I am having 3 issues:-
1)I used '&' , still Ping output is coming onto screen(Not Desirable, I have tried Redirection[>] also).
2)When I stop Ping with Cntl+C, it gives %packet loss line and max/avg/min Line. But here as I abruptly killed using pkill,those lines were not printed.
3)How to Run Ping in Background and also catch output in a file simultaneously?

I will be grateful if anyone can Produce a Solution to this Problem.

Thanx and Regards



Sponsored Link
Ads by Google

Response Number 1
Name: jefro
Date: February 24, 2009 at 14:01:34 Pacific
Reply:

Ping then pipe to is what you want.

Also use ping options for times, not sleep.

"Best Practices", Event viewer, host file, perfmon, antivirus, anti-spyware, Live CD's, backups, are in my top 10


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Ping LDAP Server from Script

Solaris can't ping otherLAN server www.computing.net/answers/solaris/solaris-cant-ping-otherlan-server/2748.html

Enterprise FTP server software for Sun? www.computing.net/answers/solaris/enterprise-ftp-server-software-for-sun/1553.html

ip configuration / can't ping server www.computing.net/answers/solaris/ip-configuration-cant-ping-server/580.html