开发者

How to run ksh shell script on remote server

开发者 https://www.devze.com 2023-01-30 17:28 出处:网络
I have a ksh script 01.sh on server A a开发者_运维百科nd I need to run it on server B using ssh. I do not want to copy it on server B to run it. Also, there are 3 arguments which should be passed with

I have a ksh script 01.sh on server A a开发者_运维百科nd I need to run it on server B using ssh. I do not want to copy it on server B to run it. Also, there are 3 arguments which should be passed with this file execution.

I tried this but it does not work. $ssh serverB /usr/ga/ctm/scripts/01.sh $arg1 $arg2 $arg3 Error is: file 01.sh not found on server B

Please guide me how can I do this?


You can only execute a file on serverB if the executable file is on serverB's file system (or in it's memory somehow). There is no other way.

HOWEVER: If you have netfs you can reference the file on serverA from serverB. E.g. do:

ssh serverB /net/serverA/usr/ga/ctm/scripts/01.sh $arg1 $arg2 $arg3

You will need to ensure that netfs is set up correctly to allow serverB to read the file from serverA. Why don't you want to copy the file across? Use scp to do it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号