first commit
This commit is contained in:
18
ssh_loops/service_check_loop.sh
Normal file
18
ssh_loops/service_check_loop.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# This script will check the runing services for every host you provide in a source file.
|
||||
# Example of running ./service_check_loop.sh <some_file_with_hosts>
|
||||
|
||||
HOSTNAME=($(cat $1))
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "Syntax: ./$(basename $0) <file name>"
|
||||
exit
|
||||
fi
|
||||
|
||||
for host in "${HOSTNAME[@]}"
|
||||
do
|
||||
printf "%s " "$host,"
|
||||
SSH_OUT=$(ssh -n root@$host "netstat -pnltu|cut -d "/" -f2|sed '/^$/d'|sort|uniq"|tr '\n' ',')
|
||||
echo $SSH_OUT
|
||||
done |tee -a /tmp/$1.log
|
Reference in New Issue
Block a user