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.
精彩评论