I need to set up a script that would write the results of the ping command from one AIX server to another file may be every minute. Like this I need to gather the data for a period of 24 hours.
Can someone please help me with this?
Okay. Since ping -c 1 -w 5 (where -c is the number of ping attempts and -w is the timeout in seconds) seems to be the AIX way to ping and limit the time it takes to complete the operation:
Jim, I don't want to start a long discussion about personal likes/dislikes, but let me state I would write it like this
The cryptic [ $! -eq 0 ] && OK='pass' || OK='fail' does unnecessary evaluation of OK='pass', and would fail if such an expression would have a non-zero exit status. In comparison, if-then-else-fi is easy to understand and risk-free.
Guys, one out off topic question and maybe rather for forum administrators, but why are these questions accepted in "Emergency UNIX and Linux Support" thread?
I fully understand and accepting need of emergency consultancy with other professionals (at all it is why we are all here), but what I see is that ggayathri has nice habit to raise all his questions directly here (and personally I don't see questions related to tcpdump, netstat and Gmail marking mails coming from his server as spam as something really emergent).
Don't want to be picky, but this is degrading quality and main goal of this thread.
Guys, one out off topic question and maybe rather for forum administrators, but why are these questions accepted in "Emergency UNIX and Linux Support" thread?
I fully understand and accepting need of emergency consultancy with other professionals (at all it is why we are all here), but what I see is that ggayathri has nice habit to raise all his questions directly here (and personally I don't see questions related to tcpdump, netstat and Gmail marking mails coming from his server as spam as something really emergent).
Don't want to be picky, but this is degrading quality and main goal of this thread.
These questions are allowed in the Emergency UNIX and Linux Support forum because the question is important to the submitter and the submitter is willing to pay for the privilege of posting in this forum.
Back on topic...
I don't have any objection to Jim's use of:
except that it is using the wrong shell variable. $! expands to the process ID of the last asynchronously started command (and there are no asynchronously started commands in this script). The exit code from the last executed command is $?, so I believe the intent was:
and, the request was for a report about once a minute. Both suggested scripts will produce a report about 12 times per minute (when the target system is not responding) to a few hundred times per minute (when the target system is responding). And, since the shell variable date is not set in MadeInGermany's script or in jim mcnamara's script, the use of:
just adds a line containing "pass at " or "fail at " (while I assume the intent in both cases was to include the status and the current date and time) in the log file.
Furthermore, the command:
produces output similar to:
(using google.com instead of AIXservername since AIXservername is not the name of a host known on my network) which is written to standard output from this script. Since I assume this script will be started in the background, spewing output like this to standard output seems undesirable.
I would be tempted to use something more like:
or, if detailed ping output is desired in the log instead of just one word of status:
PS
Note that Jim's script also contains:
and MadeInGermany's script also contains:
both of which are likely to produce a diagnostic similar to:
Last edited by Don Cragun; 04-07-2016 at 03:24 AM..
Reason: Fix typos: s/pass " or "fail /pass at" or "fail at / and s/'*** $(date)/"*** $(date)"/
This User Gave Thanks to Don Cragun For This Post:
Hi
I have written below log monitoring script to egrep multiple words and redirect the output to a text file and its working fine but I want to add some more below given functionality to it, which is very advance and im not very good in it, so please help if you can :)
I am egrepping all the... (1 Reply)
I need to ping websites and I need to see which one has the highest delay.
My problem is I need to extract the name Facebook and the time=74.0 ms using awk. I need help doing this please...
PING facebook.com (173.252.90.36) 56(84) bytes of data.
64 bytes from... (5 Replies)
Hi,
I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help..
i am using below command to run script
nohup system_traps.sh &
but in some... (9 Replies)
Hi,
I am running a schedular script which will check for a specific time and do the job. I wanted to run this continuously. Meaning even after the if condition is true and it executes the job, it should start running again non stop.
I am using below script
#!/bin/sh
start:
while true
do... (10 Replies)
Hi all!!
Im using ksh and my OS is Linux.
I want to run a script for ten minutes, starting from my current system time.
How to acheive this?
Any help appreciated.
Thanks in advance (5 Replies)
how can you ping a domain and store the ip?
like given a url in a variable $url
how can i ping it?
also how can i find the local server's ip address on a cpanel server?
(i have multiple servers and didnt want to hard code it in)
(basically i want to check the domain accounts on the server,... (11 Replies)
Keep in mind that I haven't done Perl scripting for a LONG time, so I'm quite rusty.
This is what I would like to do:
- using fork, create 3 or 4 processes to read 3 or 4 different text documents containing server names or IP addresses
- in each of those processes, Perl will ping each of those... (7 Replies)
Hello members,
I have some doubts on how to write a script that can reports success / failure of a batch job ?
1. Run a batch job:
2. Wait and search for a particular string in the Log file:
tail -f log01*.txt | egrep -v "^SUCCESSFUL"
echo "continue with the other tasks"
... (1 Reply)
Hi,
How to ping an ip from an unix machine. Can you please let me know the exact command. I used and i got the below error
ping 171.18.17.2
bash: ping: command not found
Thanks n regards
Ammu (1 Reply)
Hey all. I have a long list of IP addresses I want to ping. The IP's are located in a flat file "ping_info.dat".
I was wondering what the best way to go about this would be. Can someone help me out? (2 Replies)