LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   need a help for writing automation script (https://www.linuxquestions.org/questions/programming-9/need-a-help-for-writing-automation-script-4175419352/)

suboss87 07-30-2012 08:03 AM

need a help for writing automation script
 
Hi All,
Need help for writing an automation script. Yet I had written a script but its not working,

Quote:

#!/bin/bash

#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

# switching user account
su - root (script should run as root)
echo "password"

./home/user/useradd.sh (executing the script)

finally 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.

unSpawn 07-30-2012 08:06 AM

Since you insist on violating the LQ Rules I'm giving you a 1 day timeout. Bye.

kauuttt 07-31-2012 02:13 AM

1) Please post your code under [code/] [/code] tag.
2) Sorry, I am not clear on what you are looking for, please mention your motive clearly..
But from what i understand, please check "expect" on google.
I hope it helps.

theNbomr 08-01-2012 04:25 PM

In cases where something doesn't work according to your expectations, it is necessary to tell us what your expectations are. Otherwise, we read the code, observe what it says, and either see that it can't do anything, or see what it does do. If it does something, we can only guess what your intentions were, and there is a vast universe of possibilities for what that might be. Without enough information, I might interpret your intentions incorrectly, and suggest that you need to do something like adding
Code:

// rm command removed
Luckily, this is seldom the solution for anyone, so I'm not suggesting it.

--- rod

crabboy 08-02-2012 09:47 AM

Not suggesting it, but you felt the need to put it anyway. Modern rm implementations will recommend against it, but I don't think that's a good suggestion as your sarcasm may not be interpreted as such.

theNbomr 08-02-2012 10:36 AM

Sarcasm?


All times are GMT -5. The time now is 08:40 PM.