I have below script which creates user list and also filters ignore.txt file to ignore matching usernames. I would like to run this script on multiple hosts like hostA, hostB, hostC. Like if I run on one server it should run on other 4 servers and get the output and mail the output.
#!/bin/sh
(
echo List of users in PRD
echo
date
echo
grep -wvf ignore.txt /etc/passwd | awk -F: -v OFS=: '{print $1,$3,$5}' | sort
) | tee "$(hostname)"_userlogins.txt |
mailx -s file xxxxxx@unix.com