LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



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

Rep: Reputation: 0
Question need a help for writing shell script


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.
 
Old 07-30-2012, 09:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
Old 08-01-2012, 01:53 AM   #3
rakrr786
Member
 
Registered: May 2012
Posts: 34

Rep: Reputation: Disabled
try ssh 172.29.16.19 /home/user/useradd.sh in your script for execution
 
Old 08-01-2012, 02:58 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
please don't reply to thread marked for closure
 
1 members found this post helpful.
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 with writing a c shell script? Ajit Gunge Linux - Newbie 5 06-21-2012 01:58 AM
Help writing a shell script! smoothdogg00 Programming 5 04-26-2006 12:15 PM
[SOLVED] Writing a shell script mattz40 Debian 5 04-13-2005 07:56 PM
writing a shell script tchoua Linux - General 8 02-24-2005 07:18 PM
help writing shell script np complete Linux - Newbie 6 08-30-2004 10:43 PM


All times are GMT -5. The time now is 05:50 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration