<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Simple Linux and UNIX system monitoring with ping command and scripts</title> <atom:link href="http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Der</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-176452</link> <dc:creator>Der</dc:creator> <pubDate>Sun, 04 Dec 2011 01:06:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-176452</guid> <description>@Константин Кръстев
I love your line, but could you explain the bit after the &quot;&gt;&quot; I don&#039;t get that.
It does work I just don&#039;t know why!
Thanks,
Der</description> <content:encoded><![CDATA[<p>@Константин Кръстев<br
/> I love your line, but could you explain the bit after the &#8220;&gt;&#8221; I don&#8217;t get that.</p><p>It does work I just don&#8217;t know why!</p><p>Thanks,<br
/> Der</p> ]]></content:encoded> </item> <item><title>By: Константин Кръстев</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-175946</link> <dc:creator>Константин Кръстев</dc:creator> <pubDate>Wed, 23 Nov 2011 14:57:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-175946</guid> <description>ping -qnc 2 google.com &gt; /dev/null 2&gt;&amp;1 &amp;&amp; echo &#039;Host up!&#039; &#124;&#124; echo  &#039;Host down!&#039;</description> <content:encoded><![CDATA[<p>ping -qnc 2 google.com &gt; /dev/null 2&gt;&amp;1 &amp;&amp; echo &#8216;Host up!&#8217; || echo  &#8216;Host down!&#8217;</p> ]]></content:encoded> </item> <item><title>By: blognadei</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-175169</link> <dc:creator>blognadei</dc:creator> <pubDate>Mon, 24 Oct 2011 10:39:03 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-175169</guid> <description>thanks ,  this work :D</description> <content:encoded><![CDATA[<p>thanks ,  this work :D</p> ]]></content:encoded> </item> <item><title>By: YC</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-172611</link> <dc:creator>YC</dc:creator> <pubDate>Wed, 20 Jul 2011 14:19:37 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-172611</guid> <description>This is a great tutorial but there is a little problem. Your cron job won&#039;t be executed every 30 minutes but instead 1 time per hour at 30 minute (1:30, 2:30, 3:30). To run it every 30 min, you should change the first parameter to */30.</description> <content:encoded><![CDATA[<p>This is a great tutorial but there is a little problem. Your cron job won&#8217;t be executed every 30 minutes but instead 1 time per hour at 30 minute (1:30, 2:30, 3:30). To run it every 30 min, you should change the first parameter to */30.</p> ]]></content:encoded> </item> <item><title>By: Henrik C</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-172348</link> <dc:creator>Henrik C</dc:creator> <pubDate>Fri, 08 Jul 2011 11:24:48 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-172348</guid> <description>Hi coders
What would i use if i needed 1 timestamp when &quot;Ping up again&quot;  ?
Thanks</description> <content:encoded><![CDATA[<p>Hi coders</p><p>What would i use if i needed 1 timestamp when &#8220;Ping up again&#8221;  ?</p><p>Thanks</p> ]]></content:encoded> </item> <item><title>By: shilpa</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170822</link> <dc:creator>shilpa</dc:creator> <pubDate>Fri, 22 Apr 2011 17:58:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170822</guid> <description>can anybody suggest me a solution plz</description> <content:encoded><![CDATA[<p>can anybody suggest me a solution plz</p> ]]></content:encoded> </item> <item><title>By: shilpa</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170821</link> <dc:creator>shilpa</dc:creator> <pubDate>Fri, 22 Apr 2011 17:58:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170821</guid> <description>hi,
i am doing a small program on the working of ping command in linux using icmp protocol. here is the code but its giving an error at getuid()
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
char dst_addr[20];
char src_addr[20];
unsigned short in_cksum(unsigned short*,int);
void parse_argvs(char**,char*,char*);
void usage();
char *getip();
char *toip(char*);
int main(int argc, char *argv[])
{
struct iphdr *ip;
struct iphdr *ip_reply;
struct icmphdr *icmp;
struct sockaddr_in connection;
char *packet=NULL;
char *buffer=NULL;
int sockfd;
int optval;
int addrlen;
int siz;
printf(&quot;%d&quot;,getuid());
if(getuid()!=0)
{
fprintf(stderr,&quot;%s:rot privileges needed\n&quot;,*(argv+0));
exit(EXIT_FAILURE);
}
parse_argvs(argv,dst_addr,src_addr);
strncpy(dst_addr,toip(dst_addr),20);
strncpy(src_addr,toip(src_addr),20);
printf(&quot;src addr is %s\n&quot;,src_addr);
printf(&quot;dest addre is %s\n&quot;,dst_addr);
packet=malloc(sizeof(struct iphdr) + sizeof(struct icmphdr));
buffer=malloc(sizeof(struct iphdr) + sizeof(struct icmphdr));
ip=(struct iphdr *)packet;
icmp=(struct icmphdr *)(packet + sizeof(struct iphdr));
ip-&gt;ihl=5;
ip-&gt;version=4;
ip-&gt;tos=0;
ip-&gt;tot_len=sizeof(struct iphdr) + sizeof(struct icmphdr);
ip-&gt;id=htons(0);
ip-&gt;frag_off=0;
ip-&gt;ttl=64;
ip-&gt;protocol=IPPROTO_ICMP;
ip-&gt;saddr=inet_addr(src_addr);
ip-&gt;daddr=inet_addr(dst_addr);
ip-&gt;check=in_cksum((unsigned short *)ip,sizeof(struct iphdr));
if((sockfd=socket(AF_INET,SOCK_RAW,IPPROTO_ICMP))==-1)
{
perror(&quot;socket&quot;);
exit(EXIT_FAILURE);
}
setsockopt(sockfd,IPPROTO_IP,IP_HDRINCL,&amp;optval,sizeof(int));
icmp-&gt;type=ICMP_ECHO;
icmp-&gt;code=0;
icmp-&gt;un.echo.id=random();
icmp-&gt;un.echo.sequence=0;
icmp-&gt;checksum=in_cksum((unsigned short *)icmp,sizeof(struct icmphdr));
connection.sin_family=AF_INET;
connection.sin_addr.s_addr=inet_addr(dst_addr);
sendto(sockfd,packet,ip-&gt;tot_len,0,(struct sockaddr *)&amp;connection,sizeof(struct sockaddr));
printf(&quot;sent %d byte packet to %s\n&quot;,ip-&gt;tot_len,dst_addr);
addrlen=sizeof(connection);
if((siz=recvfrom(sockfd,buffer,sizeof(struct iphdr) + sizeof(struct icmphdr),0,(struct sockaddr *)&amp;connection,&amp;addrlen))==-1)
{
perror(&quot;recv&quot;);
}
else
{
printf(&quot;received %d byte reply from %s\n&quot;,siz,dst_addr);
ip_reply=(struct iphdr *)buffer;
printf(&quot;ID: %d\n&quot;,ntohs(ip_reply-&gt;id));
printf(&quot;ttl:%d\n&quot;,ip_reply-&gt;ttl);
}
free(packet);
free(buffer);
close(sockfd);
return 0;
}
void parse_argvs(char **argv,char *dst,char *src)
{
int i;
if(!(*(argv + 1 ) ) )
{
usage();
exit(EXIT_FAILURE);
}
if(*(argv + 1) &amp;&amp; (!(*(argv + 2 ) ) ) )
{
strncpy(dst,*(argv + 1),15);
return;
}
else if((*(argv + 1 ) &amp;&amp; (* ( argv + 2 ) ) ) )
{
strncpy(dst,*(argv + 1 ),15);
i=2;
while(*(argv + i + 1 ) )
{
if(strncmp(*(argv + i),&quot;-s&quot;,2)==0)
{
strncpy(src,*(argv + i + 1),15);
break;
}
i++;
}
}
}
void usage()
{
fprintf(stderr, &quot;\n usage:ping [destination]  \n&quot;);
fprintf(stderr,&quot;destination must be provided\n&quot;);
fprintf(stderr,&quot;source is optional \n \n&quot;);
}
char * getup()
{
char buffer[256];
struct hostent *h;
gethostname(buffer,256);
h=gethostbyname(buffer);
return inet_ntoa(*(struct in_addr *)h-&gt;h_addr);
}
char * toip(char * address)
{
struct hostent *h;
h=gethostbyname(address);
return inet_ntoa(*(struct in_addr *)h-&gt;h_addr);
}
unsigned short in_cksum(unsigned short *addr, int len)
{
register int sum=0;
u_short answer=0;
register u_short *w=addr;
register int nleft=len;
while(nleft &gt; 1)
{
sum+=*w++;
nleft-=2;
}
if(nleft==1)
{
*(u_char*) (&amp;answer)=*(u_char*)w;
sum+=answer;
}
sum=(sum&gt;&gt;16) + (sum &amp; 0xffff);
sum+=(sum&gt;&gt;16);
answer=~sum;
return(answer);
}</description> <content:encoded><![CDATA[<p>hi,<br
/> i am doing a small program on the working of ping command in linux using icmp protocol. here is the code but its giving an error at getuid()</p><p>#include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> #include<br
/> char dst_addr[20];<br
/> char src_addr[20];<br
/> unsigned short in_cksum(unsigned short*,int);<br
/> void parse_argvs(char**,char*,char*);<br
/> void usage();<br
/> char *getip();<br
/> char *toip(char*);<br
/> int main(int argc, char *argv[])<br
/> {<br
/> struct iphdr *ip;<br
/> struct iphdr *ip_reply;<br
/> struct icmphdr *icmp;<br
/> struct sockaddr_in connection;<br
/> char *packet=NULL;<br
/> char *buffer=NULL;<br
/> int sockfd;<br
/> int optval;<br
/> int addrlen;<br
/> int siz;<br
/> printf(&#8220;%d&#8221;,getuid());<br
/> if(getuid()!=0)<br
/> {<br
/> fprintf(stderr,&#8221;%s:rot privileges needed\n&#8221;,*(argv+0));<br
/> exit(EXIT_FAILURE);<br
/> }<br
/> parse_argvs(argv,dst_addr,src_addr);<br
/> strncpy(dst_addr,toip(dst_addr),20);<br
/> strncpy(src_addr,toip(src_addr),20);<br
/> printf(&#8220;src addr is %s\n&#8221;,src_addr);<br
/> printf(&#8220;dest addre is %s\n&#8221;,dst_addr);<br
/> packet=malloc(sizeof(struct iphdr) + sizeof(struct icmphdr));<br
/> buffer=malloc(sizeof(struct iphdr) + sizeof(struct icmphdr));<br
/> ip=(struct iphdr *)packet;<br
/> icmp=(struct icmphdr *)(packet + sizeof(struct iphdr));<br
/> ip-&gt;ihl=5;<br
/> ip-&gt;version=4;<br
/> ip-&gt;tos=0;<br
/> ip-&gt;tot_len=sizeof(struct iphdr) + sizeof(struct icmphdr);<br
/> ip-&gt;id=htons(0);<br
/> ip-&gt;frag_off=0;<br
/> ip-&gt;ttl=64;<br
/> ip-&gt;protocol=IPPROTO_ICMP;<br
/> ip-&gt;saddr=inet_addr(src_addr);<br
/> ip-&gt;daddr=inet_addr(dst_addr);<br
/> ip-&gt;check=in_cksum((unsigned short *)ip,sizeof(struct iphdr));<br
/> if((sockfd=socket(AF_INET,SOCK_RAW,IPPROTO_ICMP))==-1)<br
/> {<br
/> perror(&#8220;socket&#8221;);<br
/> exit(EXIT_FAILURE);<br
/> }<br
/> setsockopt(sockfd,IPPROTO_IP,IP_HDRINCL,&amp;optval,sizeof(int));<br
/> icmp-&gt;type=ICMP_ECHO;<br
/> icmp-&gt;code=0;<br
/> icmp-&gt;un.echo.id=random();<br
/> icmp-&gt;un.echo.sequence=0;<br
/> icmp-&gt;checksum=in_cksum((unsigned short *)icmp,sizeof(struct icmphdr));<br
/> connection.sin_family=AF_INET;<br
/> connection.sin_addr.s_addr=inet_addr(dst_addr);<br
/> sendto(sockfd,packet,ip-&gt;tot_len,0,(struct sockaddr *)&amp;connection,sizeof(struct sockaddr));<br
/> printf(&#8220;sent %d byte packet to %s\n&#8221;,ip-&gt;tot_len,dst_addr);<br
/> addrlen=sizeof(connection);<br
/> if((siz=recvfrom(sockfd,buffer,sizeof(struct iphdr) + sizeof(struct icmphdr),0,(struct sockaddr *)&amp;connection,&amp;addrlen))==-1)<br
/> {<br
/> perror(&#8220;recv&#8221;);<br
/> }<br
/> else<br
/> {<br
/> printf(&#8220;received %d byte reply from %s\n&#8221;,siz,dst_addr);<br
/> ip_reply=(struct iphdr *)buffer;<br
/> printf(&#8220;ID: %d\n&#8221;,ntohs(ip_reply-&gt;id));<br
/> printf(&#8220;ttl:%d\n&#8221;,ip_reply-&gt;ttl);<br
/> }<br
/> free(packet);<br
/> free(buffer);<br
/> close(sockfd);<br
/> return 0;<br
/> }</p><p> void parse_argvs(char **argv,char *dst,char *src)<br
/> {<br
/> int i;<br
/> if(!(*(argv + 1 ) ) )<br
/> {<br
/> usage();<br
/> exit(EXIT_FAILURE);<br
/> }<br
/> if(*(argv + 1) &amp;&amp; (!(*(argv + 2 ) ) ) )<br
/> {<br
/> strncpy(dst,*(argv + 1),15);<br
/> return;<br
/> }<br
/> else if((*(argv + 1 ) &amp;&amp; (* ( argv + 2 ) ) ) )<br
/> {<br
/> strncpy(dst,*(argv + 1 ),15);<br
/> i=2;<br
/> while(*(argv + i + 1 ) )<br
/> {<br
/> if(strncmp(*(argv + i),&#8221;-s&#8221;,2)==0)<br
/> {<br
/> strncpy(src,*(argv + i + 1),15);<br
/> break;<br
/> }<br
/> i++;<br
/> }<br
/> }<br
/> }</p><p> void usage()<br
/> {<br
/> fprintf(stderr, &#8220;\n usage:ping [destination]  \n&#8221;);<br
/> fprintf(stderr,&#8221;destination must be provided\n&#8221;);<br
/> fprintf(stderr,&#8221;source is optional \n \n&#8221;);<br
/> }<br
/> char * getup()<br
/> {<br
/> char buffer[256];<br
/> struct hostent *h;<br
/> gethostname(buffer,256);<br
/> h=gethostbyname(buffer);<br
/> return inet_ntoa(*(struct in_addr *)h-&gt;h_addr);<br
/> }<br
/> char * toip(char * address)<br
/> {<br
/> struct hostent *h;<br
/> h=gethostbyname(address);<br
/> return inet_ntoa(*(struct in_addr *)h-&gt;h_addr);<br
/> }<br
/> unsigned short in_cksum(unsigned short *addr, int len)<br
/> {<br
/> register int sum=0;<br
/> u_short answer=0;<br
/> register u_short *w=addr;<br
/> register int nleft=len;<br
/> while(nleft &gt; 1)<br
/> {<br
/> sum+=*w++;<br
/> nleft-=2;<br
/> }<br
/> if(nleft==1)<br
/> {<br
/> *(u_char*) (&amp;answer)=*(u_char*)w;<br
/> sum+=answer;<br
/> }<br
/> sum=(sum&gt;&gt;16) + (sum &amp; 0xffff);<br
/> sum+=(sum&gt;&gt;16);<br
/> answer=~sum;<br
/> return(answer);<br
/> }</p> ]]></content:encoded> </item> <item><title>By: shilpa</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170799</link> <dc:creator>shilpa</dc:creator> <pubDate>Fri, 22 Apr 2011 10:29:58 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170799</guid> <description>have to implement ping command using raw socket in unix</description> <content:encoded><![CDATA[<p>have to implement ping command using raw socket in unix</p> ]]></content:encoded> </item> <item><title>By: Amza Marian</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170705</link> <dc:creator>Amza Marian</dc:creator> <pubDate>Tue, 19 Apr 2011 20:18:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170705</guid> <description>@shilpa: PING using icmp protocol. You can read more here:
http://www.iana.org/assignments/icmp-parameters</description> <content:encoded><![CDATA[<p>@shilpa: PING using icmp protocol. You can read more here:<br
/> <a
href="http://www.iana.org/assignments/icmp-parameters" rel="nofollow">http://www.iana.org/assignments/icmp-parameters</a></p> ]]></content:encoded> </item> <item><title>By: shilpa</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170700</link> <dc:creator>shilpa</dc:creator> <pubDate>Tue, 19 Apr 2011 14:25:19 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170700</guid> <description>how to check server is alive using ping command at client in unix system programming using ICMP protocol</description> <content:encoded><![CDATA[<p>how to check server is alive using ping command at client in unix system programming using ICMP protocol</p> ]]></content:encoded> </item> <item><title>By: Vivek Gite</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170496</link> <dc:creator>Vivek Gite</dc:creator> <pubDate>Thu, 07 Apr 2011 03:00:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170496</guid> <description>Check dns settings in /etc/resolv.conf file including firewall settings.</description> <content:encoded><![CDATA[<p>Check dns settings in /etc/resolv.conf file including firewall settings.</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170495</link> <dc:creator>Peter</dc:creator> <pubDate>Thu, 07 Apr 2011 00:14:06 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170495</guid> <description>It works fine except i tried to use it to make sure my internet connection was still up and if the internet connection fails It can&#039;t resolve the host so it can&#039;t try ping to ping it.  How could i add a check for this situation?</description> <content:encoded><![CDATA[<p>It works fine except i tried to use it to make sure my internet connection was still up and if the internet connection fails It can&#8217;t resolve the host so it can&#8217;t try ping to ping it.  How could i add a check for this situation?</p> ]]></content:encoded> </item> <item><title>By: Amza Marian</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170453</link> <dc:creator>Amza Marian</dc:creator> <pubDate>Sun, 03 Apr 2011 14:35:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170453</guid> <description>HTF: Yes
if [ $count -eq 0 ]; then  &lt;- only if 100% failed.</description> <content:encoded><![CDATA[<p>HTF: Yes</p><p>if [ $count -eq 0 ]; then  &lt;- only if 100% failed.</p> ]]></content:encoded> </item> <item><title>By: HTF</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170449</link> <dc:creator>HTF</dc:creator> <pubDate>Sun, 03 Apr 2011 02:24:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-170449</guid> <description>Quick question:
If I set the ping count to 4 and only one of four will failed will I get the true positive alarm anyway?</description> <content:encoded><![CDATA[<p>Quick question:<br
/> If I set the ping count to 4 and only one of four will failed will I get the true positive alarm anyway?</p> ]]></content:encoded> </item> <item><title>By: Bob Watson</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-168671</link> <dc:creator>Bob Watson</dc:creator> <pubDate>Wed, 09 Feb 2011 16:32:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-168671</guid> <description>Along a slightly different vein- I&#039;ve got my e-mail client set to start as soon as I log in, which is often before the network is online.  It then tells me it can&#039;t find the server and decides to work off-line.  This is annoying, so I added a slight modification of the above at the head of its initialisation script:
while :
do
count=$(ping -c 1 imap.1and1.co.uk &#124; grep &#039;received&#039; &#124; awk -F&#039;,&#039; &#039;{ print $2 }&#039; &#124; awk &#039;{ print $1 }&#039;)
if [ $count -eq 1 ]; then
break
fi
sleep 5
done</description> <content:encoded><![CDATA[<p>Along a slightly different vein- I&#8217;ve got my e-mail client set to start as soon as I log in, which is often before the network is online.  It then tells me it can&#8217;t find the server and decides to work off-line.  This is annoying, so I added a slight modification of the above at the head of its initialisation script:</p><p>while :<br
/> do<br
/> count=$(ping -c 1 imap.1and1.co.uk | grep &#8216;received&#8217; | awk -F&#8217;,&#8217; &#8216;{ print $2 }&#8217; | awk &#8216;{ print $1 }&#8217;)<br
/> if [ $count -eq 1 ]; then<br
/> break<br
/> fi<br
/> sleep 5<br
/> done</p> ]]></content:encoded> </item> <item><title>By: difa</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-163030</link> <dc:creator>difa</dc:creator> <pubDate>Mon, 13 Dec 2010 04:23:50 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-163030</guid> <description>nice..
thanks you ^,^</description> <content:encoded><![CDATA[<p>nice..<br
/> thanks you ^,^</p> ]]></content:encoded> </item> <item><title>By: Ernest</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-156680</link> <dc:creator>Ernest</dc:creator> <pubDate>Thu, 17 Jun 2010 17:34:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-156680</guid> <description>@BenV - Will your script work if $host does not exist? Typo&#039;s happen.
Will adding a  &#039;ping -c1 -w1&quot; enable a timeout and avoid hanging indefinitely?  or is the -w not used that way?</description> <content:encoded><![CDATA[<p>@BenV &#8211; Will your script work if $host does not exist? Typo&#8217;s happen.</p><p>Will adding a  &#8216;ping -c1 -w1&#8243; enable a timeout and avoid hanging indefinitely?  or is the -w not used that way?</p> ]]></content:encoded> </item> <item><title>By: Amza Marian</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-155993</link> <dc:creator>Amza Marian</dc:creator> <pubDate>Thu, 13 May 2010 11:09:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-155993</guid> <description>@ishfaq :
echo &quot;Host : $myHost is down (ping failed) at $(date)&quot; &gt;&gt; /var/www/network.txt</description> <content:encoded><![CDATA[<p>@ishfaq :</p><p>echo &#8220;Host : $myHost is down (ping failed) at $(date)&#8221; &gt;&gt; /var/www/network.txt</p> ]]></content:encoded> </item> <item><title>By: ishfaq</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-153826</link> <dc:creator>ishfaq</dc:creator> <pubDate>Sat, 20 Feb 2010 19:16:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-153826</guid> <description>nice script but any tell how to paste the out put on apache page</description> <content:encoded><![CDATA[<p>nice script but any tell how to paste the out put on apache page</p> ]]></content:encoded> </item> <item><title>By: Saurabh</title><link>http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-145599</link> <dc:creator>Saurabh</dc:creator> <pubDate>Mon, 17 Nov 2008 08:55:06 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html#comment-145599</guid> <description>Short and sweet code Benv</description> <content:encoded><![CDATA[<p>Short and sweet code Benv</p> ]]></content:encoded> </item> </channel> </rss>
