LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Closed Thread
  Search this Thread
Old 07-30-2012, 07:59 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, 08:00 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
1 members found this post helpful.
  


Closed Thread



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 a help for writing shell script suboss87 Linux - Server 3 08-01-2012 01:58 AM
[SOLVED] need a help for writing shell script suboss87 Linux - Newbie 7 07-29-2012 05:12 PM
Need help with writing a c shell script? Ajit Gunge Linux - Newbie 5 06-21-2012 12:58 AM
Help writing a shell script! smoothdogg00 Programming 5 04-26-2006 11:15 AM
Need Help in Writing a Shell Script. KptnKrill Linux - General 2 05-19-2003 05:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:11 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