Hi All,
Need help for writing an automation script. Yet I had written a script my own but its not working,
Code:
#!/bin/bash
#At first step copying files from local machine to remote server by scp
scp -r /useradd.sh user@172.29.16.19:/home/user
# Second step making ssh login for executing the script on remote server
ssh@172.29.16.19
# 3rd step switching user account
su - root (script should run as root)
echo "password"
# 4th step Executing the script on remote server
./home/user/useradd.sh
# 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.