Discussion Locked

Unix shell Script for network management

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do you write a shell script(not an AWD script) as a network management program to track host computers entered on the command line, in a file or hard coded in the script. This shell script should be able to use ping with sed.

5 replies

by mtuppen

I don't know why you want the script exactly, but if you are wanting to keep a track of multiple hosts (ping, services etc) try using a program called big brother. We use it, and it is quite effective. You can get it from bb4.com.

Regards,
Mike

by mtuppen

If you are after a script, I do have a little script that replies "yes" if the host is pingable, and "no" if it isn't. Of course, you can change the outcomes. I didn't use sed, but I used grep. It expects the host to be the first argument on the command line.

#!/bin/bash
PHST=$1
PVAR=`ping $PHST -c1 -w3 2>/dev/null`
PVAR=`echo $PVAR |grep "from $PHST"`
if [ "$PVAR" ]; then
echo "Yeah"
else
echo "No"
fi

Regards,
Mike

This discussion is closed to new replies.