1834355 Members
3364 Online
110066 Solutions
New Discussion

Script for ping

 
SOLVED
Go to solution
pgorn
Frequent Advisor

Script for ping

One of my servers keep losing network connection but my logs show nothing. So I need to beable to check the connection for 24 hours. I am not good at scripts. Any help
Thank you,
6 REPLIES 6
Rick Garland
Honored Contributor
Solution

Re: Script for ping

You can placed the following in your cron and have it execute as often as you define in cron

/usr/sbin/ping -n 5 `hostname`

Execute the ping command with count (the -n switch followed by a number for the number of pings to send) to the host in specified.




Reshma Malusare
Trusted Contributor

Re: Script for ping

Hi pgorn,
1.This command tests network connections. It verifies the LAN port is configured with the appropriate IP address.

2.The destination address is the IP address that is mapped to the MAC address. Perform this task from the PC that has the ARP table entry.

Syntax

ping

Example from Windows

ping 192.0.2.1

pgorn
Frequent Advisor

Re: Script for ping

can I put this to a file and check for timeouts.
ping hostname -n 10
pgorn
Frequent Advisor

Re: Script for ping

I need to do it server to server not my PC I know how to ping I just need to ping for 24 hours straight. So I was looking for a script.
Reshma Malusare
Trusted Contributor

Re: Script for ping

Hi Pgorn,
Ok SO you want to do it for server then please try command mentioned by Rick.
Thanks,
reshma
pgorn
Frequent Advisor

Re: Script for ping

thanks