LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-30-2012, 08:03 AM   #1
suboss87
Member
 
Registered: Dec 2010
Posts: 31

Rep: Reputation: 0
Question 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.
 
Old 07-30-2012, 08:06 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

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

Last edited by unSpawn; 07-30-2012 at 08:14 AM.
 
Old 07-31-2012, 02:13 AM   #3
kauuttt
Member
 
Registered: Dec 2008
Location: Atlanta, GA, USA
Distribution: Ubuntu
Posts: 135

Rep: Reputation: 26
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.
 
1 members found this post helpful.
Old 08-01-2012, 04:25 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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

Last edited by crabboy; 08-02-2012 at 09:44 AM. Reason: Removed rm from root command
 
2 members found this post helpful.
Old 08-02-2012, 09:47 AM   #5
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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.
 
1 members found this post helpful.
Old 08-02-2012, 10:36 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Sarcasm?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help for shell script automation suboss87 Linux - Newbie 1 07-30-2012 08:00 AM
Need help for shell script automation suboss87 Linux - Server 2 07-30-2012 07:59 AM
FTP Automation script harsh_datir Linux - Networking 1 12-01-2010 01:25 AM
Automation script vijayan361 Linux - Newbie 7 01-23-2009 06:42 AM
Telnet automation script senthilvael Linux - Newbie 15 11-19-2007 04:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration