Operating System - HP-UX
1826325 Members
3459 Online
109692 Solutions
New Discussion

Remote Execution of a Script

 
kumar_choudhury
Occasional Advisor

Remote Execution of a Script

Hi,

I want excute a script(created by user) which is there in remote sytem.

Can any one help me to do this.
9 REPLIES 9
Torsten.
Acclaimed Contributor

Re: Remote Execution of a Script

The are many ways to do this.

One is

# ssh user@host command

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: Remote Execution of a Script

You can use remsh. If you don't want to enter a password, you must have a .rhosts file (permission 600).

$ remsh machine -n "command options"
Torsten.
Acclaimed Contributor

Re: Remote Execution of a Script

BTW, the ssh command works from every system that has ssh installed, not only from one hp-ux to another.
You can do this from win, linux , ...

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
kumar_choudhury
Occasional Advisor

Re: Remote Execution of a Script

When i am executing commanding using ssh it works fine but when i am trying run my script it does not works.

Torsten.
Acclaimed Contributor

Re: Remote Execution of a Script

>> it does not works

This is not very clear.

If you say "it does not works", make it work ;-)

or come back with a better description of the problem, sorry.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: Remote Execution of a Script

>but when i am trying run my script it does not works.

remsh doesn't execute .profile and $PATH is limited. You need to change your script as if it was in a crontab.
Torsten.
Acclaimed Contributor

Re: Remote Execution of a Script

According to Dennis there is a simple rule for scripts: use always the full path.

Example.

If you want to use "ls", do
# whereis ls
.../usr/bin/ls...

und use
/usr/bin/ls instead of "ls" in your scripts.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: Remote Execution of a Script

>Torsten: According to Dennis there is a simple rule for scripts: use always the full path.
>If you want to use "ls", do

Since ls(1) is in the limited $PATH, you can get away with that. :-)
PATH=/usr/bin:/usr/ccs/bin:/usr/bin/X11:/usr/contrib/bin:/usr/local/bin

But if you want to use any PATHs, aliases or functions defined in .profile or .kshrc, you are out of luck, unless you source these in your script.
Torsten.
Acclaimed Contributor

Re: Remote Execution of a Script

Should be a simple example, but isn't the best ...

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!