Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-14-2007, 07:40 AM   #1
LQ Newbie
Registered: Apr 2007
Posts: 1

Rep: Reputation: 0
Cannot run shell script on the remote server


I`m unable to execute my shell script on the remote db server for monitoring. However i`m able to connect the remote server but the scripts are not executing remotely.

I would like to run the scripts on the remote box

Please help
Old 04-14-2007, 09:40 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,274
Blog Entries: 10

Rep: Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847
You can't execute a script from a local box on a remote box. You can however put in commands to execute on a remote box from the local box OR you can copy the local script to the remote box then use the local box to tell it to run there.

Say you had a simple script and named it ""
ls -l
df -h
This script should run fine on the local box just by typing "./". However if you tried to run it remotely by typing:

ssh user@remotehost ./

It wouldn't work because doesn't exist on the remote. You could simply copy this to the remote host and then run it.

Alternatively you could modify the script:
ssh user@remotehost "/bin/ls -l"
ssh user@remotehost "/bin/df -h"
Here you're telling it to execute each of the commands of the script remotely. The downside of this is that if you don't have an ssh trust setup it will prompt you for the password each time it executes and ssh in the script.
Old 04-14-2007, 10:26 AM   #3
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,191
Blog Entries: 4

Rep: Reputation: 464Reputation: 464Reputation: 464Reputation: 464Reputation: 464
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to easily shutdown a remote linux server with a shell script? bdb4269 Programming 7 01-26-2007 05:08 PM
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 04:23 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 07:49 AM
Remote Win Bat File execute Shell Script on AIX Server DriveMeCrazy AIX 5 05-26-2004 07:24 PM
telneting remote machine from a shell script sanjith11 Programming 11 05-26-2004 07:50 AM

All times are GMT -5. The time now is 09:28 PM.

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