Shell script to get local user account list from multiple Linux servers

//save below script as checkstatus.sh 

#!/bin/bash

password="Passw**d"

echo "Hostname"

echo "~~~~~~~~"

hostname

echo "Local Users Count"

echo "~~~~~~~~~~~~~~~~~"

cat /etc/passwd | grep bin/bash -wc

echo "Subscription Status"

echo "~~~~~~~~~~~~~~~~~~~"

echo ${password} | sudo -S subscription-manager list | grep Ends:


-----------------

//call above script inside another script for make this job to test multiple servers.

//save below script as execute.sh

#!/bin/bash

username=username

for i in `cat ip.txt`

do

ssh ${username}@${i} 'bash -s' <checkstatus.sh

done

-------------------


Post a Comment

0 Comments