Need help for writing an automation script. Yet I had written a script my own but its not working,
#At first step copying files from local machine to remote server by scp
scp -r /useradd.sh email@example.com:/home/user
# Second step making ssh login for executing the script on remote server
# 3rd step switching user account
su - root (script should run as root)
# 4th step Executing the script on remote server
# at 5th step - i have to capture a log of the script process.
This is my script for automation, Were i have run the "useradd.sh" script on the remote servers from my local machine.Kindly help me to write a clear script.
Thanks in advance.