What have you tried so far? Where is the particular problem? There is often being asked for a script to ping hosts and also questions on how to send mails. Show efforts please and be it at least to use the search function of the forum first, thanks.
I moderate any answers with complete solutions before the OP didn't answer - thanks for your understanding.
You'd really just want to output the results to a file and then mail the entire file to your designated recipients. Such as the much maligned:
Just as an aside, however, you might want to think about listing internal domain contents when posting on a forum like this. Just as a matter of security...it's generally best if you don't broadcast the contents of your pockets.
The scripts I got are very good and they worked fine.
But they just send the email with the server names which are down.
But my management is expecting an email something like the below one :
Please assist
There should be a line where you test the output of ping, maybe rest the return code or parse it's output, whatever. At this place just put another if condition or something an pass those that are positiv ie. alive to the same file, concatenating it.
help with bash script!
im am working on this script to make sure my server will stay online, so i made this script..
HOSTS="192.168.138.155"
COUNT=4
pingtest(){
for myhost in "$@"
do
ping -c "$COUNT" "$myhost" &&return 1
done
return 0
}
if pingtest $HOSTS
#100% failed... (4 Replies)
Hello,
I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file.
For example;-
In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Hi I am trying to write a script which runs until the host is up. i got it figured out that it needs to be in loop till it return $? = 0.
Not getting it through though. I am not sure about the 6th line !!!
#!/bin/sh
HOSTS="host.txt"
ping(){
for myhost in "$HOSTS"
do
ping -c -1 "$myhost"... (8 Replies)
Hi,
I wanted to add a email option to this script. and was wondering if anyone could help me out.
#!/bin/ksh
echo "Finding hdisk"
<DIR>/find-disk
i=1
b=0
p=0
while ... (2 Replies)
HI,
I have a file serverlist in that all host names are placed.
i have written a small script
#./testping
#! /bin/bash
for i in `cat serverlist`
do
ping $i >> output.txt
done
so now it creates a file output.txt till here fine..
now each time i run this script the output file... (4 Replies)
Hi,
I am able to send email from AIX using the following command.
cat email.txt | mail -s "Mail Subject" venkat@gmail.com
Our requirement is send email with cc and bcc option.
We are getting email with from email address as our UNIX server user.
We would like to change that, please let us know... (2 Replies)
could someone show me a sample command line option driven script?
i want to see an easy way to write one and how i can execute it using command line options such as typing in
read.pl -i <id> -c <cmds> -s <start> -e <end>
would read out all the commands run by ID . from start time to... (7 Replies)
Hey,
after I check the man page for mail and mailx, I did not find the -r option. But, I have to change the email sender, how can I do it?
Send Mode
mailx address...
Receive Mode
mailx -e
mailx
mailx -f
... (0 Replies)
To find all the files in your home directory that have been edited in some way since the last tar file, use this command:
find . -newer backup.tar.gz
Is anyone familiar with an older solution?
looking to identify files older then 15mins across several directories.
thanks,
manny (2 Replies)