rsh problem

I tried to execute by rsh a script, but I did not succeed.
You can execute only commnads (not scripts) by rsh or there are some other restrictions?!?

root@a1 #pwd
/
root@a1 #rsh a2 monitor
ksh: monitor:  not found

On the other hand:

root@a1 #rsh a2
root@a2 #pwd
/
root@a2 #ls monitor
-rwxr--r--  .....  monitor
root@a2 #monitor
Monitoring started ....
......
Monitoring done.

If this is not possible then how can I run a script on a1 such that the script executes at some time another script on the remote host a2 and then returns to run on a1?

Rsh as root is not a good thing.

But to answer your question, try

root@a1 # rsh a2 ./monitor

When the rsh runs, it isn't getting the . in the PATH so it can't find ./monitor.

It doesn't work either... :o

.... and if you specify the FULL/absolute pathname to the script?

I have tried... no, I still don't get the reason...

put the 'calling' and the 'called' scripts in debug [with the 'set -x' options and see what's taking place.

just a picky
give chmod +x monitor and try...

samsam

For some machines it worked, but not for all of them...
Thanks a lot guys!

I really don't know how to use those 'calling' and the 'called' scripts ...

Have you chacked source server host's name entry on /etc/inet/hosts.equiv file of destination server.

if not present on file ,entry source server host's name.