Operating System - HP-UX
1820882 Members
3566 Online
109628 Solutions
New Discussion юеВ

Executing Multiple command in remsh

 
SOLVED
Go to solution
Nikee Reddy
Regular Advisor

Executing Multiple command in remsh

Hello,

I would like to execute the following commands from the user cn2adm.
cd /usr/sap/trans/bin
/sapmnt/CN2/exe/tp connect CN2

Note: command has to execute under the /usr/sap/trans/bin directory.

Now I want to execute these commands from root:

remsh venus -l cn2adm -n cd /usr/sap/trans/bin"

remsh venus -l cn2adm -n "/sapmnt/CN2/exe/tp connect CN2"

Instead of multiple remsh commands, how can I execute in one remsh command?

Thanks,
Nikee

3 REPLIES 3
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Executing Multiple command in remsh

Hi Nikee,

You can try

remsh venus -l cn2adm -n "cd /usr/sap/trans/bin; /sapmnt/CN2/exe/tp CN2"

Or you can push a script that has those two lines and execute that script.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Mel Burslan
Honored Contributor

Re: Executing Multiple command in remsh

remsh venus -l cn2adm -n "cd /usr/sap/trans/bin ; /sapmnt/CN2/exe/tp connect CN2"


should do it

________________________________
UNIX because I majored in cryptology...
Muthukumar_5
Honored Contributor

Re: Executing Multiple command in remsh

Hai,

remsh is going to use the remote shell. But the shell commands execution are same as local cell except the environment variables.
If we want to use the environment,

remsh otherhost . .profile 2>&- \;

We can use the ; to add the multiple commands in remote shell as local shell.

And We can put all commands in a file and make rcp to remote machine. Then do the remsh to execute that script commands.

Another way as,

echo "cd /usr/sap/trans/bin;/sapmnt/CN2/exe/tp connect CN2" | remsh "cat -"

Regards,
Muthukumar.
Easy to suggest when don't know about the problem!