Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-13-2015, 05:52 PM   #1
hassan hashmi
LQ Newbie
Registered: Mar 2015
Posts: 1

Rep: Reputation: Disabled
bash scrip running on remote server

This is my script and the syntax to run this script is give ip and next will be the file or script you want to perform on remote server


# The private key used to identify this machine

echo "Syntax: server_ip scriptFile]"
echo "For example: ./ server_ip scriptFile"
exit 1

if [ $# -ne 2 ]
echo not enough arguments

echo "Running script $2 on $1"
ssh -ttq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
echo "Done"

on script file i have give for testing

touch /root/test
ls /root/test

it makes the file but do not show the ls output by giving error

tcgetattr: Inappropriate ioctl for device


what I have to do ??
Old 03-14-2015, 12:23 AM   #2
Senior Member
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
ssh -ttq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
Try passing just one -t option like this:

ssh -tq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
As multiple -t option causes local tty allocation. Read man page of ssh.


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
[SOLVED] Bash and running remote commands ulto Programming 7 02-05-2015 09:56 PM
HELP ME: Error while running tcl scrip for ZRP in NS2.33 ubuntu 10.04 vuichoigiaitri Ubuntu 1 12-02-2012 10:11 PM
Linux bash I am writing shell scrip samuel.m012 Linux - Newbie 4 05-28-2010 08:39 AM
I cannot move a my file into my archives directory in my bash scrip Aubrey0406 Linux - Newbie 7 04-13-2010 06:01 AM
Problems running PHP scrip in command line Hondro Programming 0 06-21-2007 02:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:17 AM.

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