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:

#!/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! :slight_smile:

If you want to execute a script on a remote server you should use ssh:

#!/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

Wow, thanks so much!
This worked!! ... 99%, anyways, hahaha.
Because I used keys, I just had to make it:

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

Regardless, you pretty much got me there! :slight_smile: