LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  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



#!/bin/bash

# The private key used to identify this machine
IDENTITY_KEY=/home/adnew.pem

syntax()
{
echo "Syntax: Ec2.sh server_ip scriptFile]"
echo "For example: ./Ec2.sh server_ip scriptFile"
exit 1
}

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


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



on script file i have give for testing

touch /root/test
ls /root/test
exit
exit

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


tcgetattr: Inappropriate ioctl for device

exit


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

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

Code:
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.
 
  


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
[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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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