Running a script from another server (sh)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running a script from another server (sh)
# 1  
Old 11-23-2010
Running a script from another server (sh)

I have a script where it finds the most current modified file in a directory, transfers that file into another server, then run a script which is on that another server.

I can find the file and transfer it fine, but when it comes to running the script on the other server, it just doesn't work.
The error message says that there is no such file or directory, which I'm assuming that the script doesn't even look in the other server when it tries to run this line.

Here is what I have so far:

Code:
#!/bin/sh

FILENAME=$(ls -1 -t --escape /opt/logs/|head -1)

scp -i /home/nessus "/opt/sc4/admin/logs/$FILENAME" acsv_nessus\@server:/opt/Data

acsv_nessus\@CAVTSASL717:/home/nessus/run_data

#end of script

Many thanks for any feedback! Smilie
# 2  
Old 11-23-2010
If you want to execute a script on a remote server you should use ssh:

Code:
#!/bin/sh

FILENAME=$(ls -1 -t --escape /opt/logs/|head -1)

scp -i /home/nessus "/opt/sc4/admin/logs/$FILENAME" acsv_nessus\@server:/opt/Data

ssh acsv_nessus\@CAVTSASL717 /home/nessus/run_data

#end of script

# 3  
Old 11-23-2010
Wow, thanks so much!
This worked!! ... 99%, anyways, hahaha.
Because I used keys, I just had to make it:

Code:
ssh -i acsv_nessus\@CAVTSASL717 /home/nessus/run_data

Regardless, you pretty much got me there! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

2. UNIX for Dummies Questions & Answers

Transfer file from server B to server C and running the script on server A

I have 3 servers A, B, C and server B is having some files in /u01/soa/ directory, these files i want to copy to server C, and i want to run the script from server A. Script(Server A) --> Files at Server B (Source server) --> Copy the files to Server C(Target Server). We dont have RSA key... (4 Replies)
Discussion started by: kiran_j
4 Replies

3. Shell Programming and Scripting

Running script on remote server

Hi All, I need to run a ksh script on around 200 servers(consisting of AIX,LInux,HP-UX,Solaris). The script is there in the /tmp directory of all the servers. I want want to execute the script in background on the respective servers and then exit from there. I have written something like below:... (8 Replies)
Discussion started by: proactiveaditya
8 Replies

4. Shell Programming and Scripting

script for reading logs of a script running on other UNIX server

Hi, I have a script, running on some outside firwall server and it's log of success or failure is maintained in a file. I want to write a script which ftp that server and reads that file and checks the logs and if failure , I will send mail notification. Please let meknow if I am not... (1 Reply)
Discussion started by: vandana.parwani
1 Replies

5. Shell Programming and Scripting

How to stop a script running in remote server from local script

Hi, I have googled for quite some time and couldn't able to get what exactly I am looking for.. My query is "how to stop a shell script which is running inside a remote server, using a script"??? can any one give some suggestions to sort this out. (1 Reply)
Discussion started by: mannepalli
1 Replies

6. Shell Programming and Scripting

Running a Script in a Remote server

I am trying to write a script that would let me run a command in a remote server using ssh. scriptA: (dcm2nii is a command that only works on the other server) dcm2nii a b c scriptB: (I run this one on the current server) ssh -X otherserver /home/abc/Desktop/scriptA But when I do ... (2 Replies)
Discussion started by: ZeroGPX
2 Replies

7. UNIX for Dummies Questions & Answers

find the server name a script is running on

Is there any kind of command I can use to find out the name or IP address of the server I am currently on? We have a script that exists on multiple servers and I'd like to set a variable differently based on what server I am on. (3 Replies)
Discussion started by: shellburger
3 Replies

8. Shell Programming and Scripting

Running a script in a server from another server

Hi Guys Say I have two servers (A & B) and two scripts (script1 & script2). script1 will be running on server A and script2 will nbe running on server B. Now my need is to kickoff script2 (in server B) just after finishing running script1 (in server A) Any idea, how to achieve this?... (2 Replies)
Discussion started by: csaha
2 Replies

9. Shell Programming and Scripting

Running a remote Server through perl script

Hello people, I am want to run a server on remote machine through perl scripting using telnet api. Now when I try to do so, the server gets started perfectly, but as soon as I close the telnet connection in the script, the server started on the remote machine suddenly goes down. I also... (0 Replies)
Discussion started by: chandrak
0 Replies

10. Shell Programming and Scripting

running a script on remote server.

I need to run a script on a remote server from my ksh script. The issue I'm having is that I need to logon to the remote server as a different user. (see the following) logged on to server 1 as adsmgr neet to log on to server 2 as odemgr run passwd_util.ksh Thanks in advance. (1 Reply)
Discussion started by: whited05
1 Replies
Login or Register to Ask a Question