Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REMSH across HP-UX Servers

Status
Not open for further replies.

EssJayKay

Programmer
Dec 2, 2002
18
US
I have multiple servers which need to run several interactive scripts each morning and evening to bring up and shutdown an application, which includes an oracle database. The startup & shutdown scripts on each server require the user to answer questions based on the stat of the database. I would like to create a single script that would REMSH to each box and launch the startup/shutdown scripts simultaneously and allow the user to answer questions and be aware of which server is asking the question. These processes take between 1/2-1 hour to run and running one after another is not an option. Any feedback would be appreciated.
 
Do you have an X11 terminal? If you do, I would suggest a separate Xterm window for each remote server, with the title bar renamed to the name of the remote server
 
Hello EssJay,
This is a bit complicated, but when working is a fine method of automating remote administration.

First, you must establish trusted roles using /etc/hosts.equiv and/or /.rhosts files to enable the rsh processing. See the man pages for this.

Next you will need to build a Launch Script on the local machine. Here's an example:

#!/bin/sh
#####
# Remote Administration Launcher.
#####
xhost +
# Better would be xhost username, but simple works too.

rsh remotehostname "/path/RemoteControl.sh localhost" &
# This will start the script on the remote machine.

rsh remotehostname2 "/path/RemoteControl.sh localhost" &
# As many as you want.
exit 0

Then on the remote host. Create this example:

#!/bin/sh
#####
# RemoteControl.sh Script.
#####
DISPLAY=$1:0.0
export DISPLAY
# You could use xterm....
/usr/openwin/bin/xterm -e /yourpath/ControlScript.sh &
# Or you could use dtterm. See the man pages for each.
/usr/dt/bin/dtterm -e /yourpath/ControlScript.sh &
exit 0

You could compress most of the remote startup into the local script if your xterm command is simple. I recommend setting it up this way so you can more easily cusomize the xterm window and its behavior.

Lastly, if you have automounting set up, you could put all of the scripts in one location. Then set up the path for automounting in the automount configuration. This will allow you to manage your scripts from one location, yet still remote execute them.

Have Fun!
Charlie Ehler
 
What is the use of display? I could get the same result without it! Remote.sh runs perfectly displaying the output.

Remote.sh

#!/usr/bin/sh (hosta)
remsh hostbip -n /path/RemoteControl.sh
exit 0

RemoteControl.sh: (hostb)

#!/usr/bin/sh
ls
exit 0

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top