I need to connect remotely to 800 servers using a user which is having sudo access n do points(in order 1,2,3)
check status of syslog
- If running go to step 2
- If not restart d service
- If running go to step 2
Make entry in
/etc/sudoers
of remote machine- like
sudo echo "ABC" >> /etc/sudoers
- like
Make an entry in local file of local machine (in which i am executing script) of what has been done in script
I managed to create a script which starts a service remotely.
for i in `cat test1`
do
{
echo "********************************************$i***************************************************"
sshpass -p '<password>' ssh -t abc@$i "sudo /etc/init.d/httpd start
}
done
Note: Servers which are to be connected are in test1
file
Pls let me know how to integrate above three in a single script