- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Best Practice local or remote script running
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:20 AM
тАО08-24-2004 03:20 AM
My question is, now that I have this script what is the best way to check each server. Our thoughts are it would be nice to have it live on one server and run the commands remotely for each server (I don't know how to do this yet). The other option is to put the script on each server and run it via a cron. I'm looking for best practice and gotchas from anyone already doing this.
If we determine remote commands are the way to go, I may ask for help with that as well.
Thanks for all the great input here.
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:29 AM
тАО08-24-2004 03:29 AM
SolutionRunning your script from a central server is relatively easy - you just use remsh. However, this involves opening up the "r" services via /etc/hosts.equiv and/or root's ~/.rhosts. This is generally considered a security risk since passwords are transmitted in clear case. If you're securely locked away behind a firewall, the risk is minimal and this is a very convenient mechanism.
Pete
Pete
- Tags:
- remsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:33 AM
тАО08-24-2004 03:33 AM
Re: Best Practice local or remote script running
If you have scripts run through cron, you need to have a mechanism of fetching the output from the script. Again this needs some kind of remote access (automated ftp or rcp or scp).
Do you have SSH installed in the systems ?
If you need to execute the script remotely for each server, again you need to enable remote access for the server from the machine you are planning to kick off these scripts from.
There is an alternative to this, called Service Control Manager.
http://software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B8339BA3.0
A free software that can be downloaded from the above URL.
The software effectively allows you to manage multiple HP-UX servers from a single point. Review the above URL and see if that can help you.
--Sundar.
- Tags:
- ssh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:44 AM
тАО08-24-2004 03:44 AM
Re: Best Practice local or remote script running
You can then do something like: -
for HOST in server1 server2 server3
do
cat script.sh | ssh $HOST sh
done
This lets you feed a whole script to an "sh" on many machines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:50 AM
тАО08-24-2004 03:50 AM
Re: Best Practice local or remote script running
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:55 AM
тАО08-24-2004 03:55 AM
Re: Best Practice local or remote script running
No, cron only runs on your local server. However, you can tell cron to run a script which uses remsh or ssh to contact the other servers.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 04:00 AM
тАО08-24-2004 04:00 AM
Re: Best Practice local or remote script running
a better approach would be to list the host names in a file and use it in the script
# vi hosts.list
host1
host2
host3
..
#
# vi RUN-REMOTE.sh
for HOST in $(cat hosts.list)
do
ping $HOST -n 1 >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "Cannot ping $HOST" && continue
remsh $HOST date >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "Remote execution denied for this host on $HOST" && continue
cat YOUR-SCRIPT.sh | ssh $HOST sh >> $HOST.out
done
#
The above script will work provided you have SSH installed and have password-less authentication for the host or root.
Sundar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 04:03 AM
тАО08-24-2004 04:03 AM
Re: Best Practice local or remote script running
It may be the execution from local server machine or executing the script located on remote server.
Automation can be done with cron effectively.
Try to debug the script effectively with set -x it won't make any problem on the execution over crontab jobs.
And more use separate file to make as an environment to this script.
Example:
test.data
# SERVERNAME details using hostname
export SERVER="test huge find"
It will be used to manage scripts easily without looking into the shell script files.
Remote scripting / execution can be done using r* commands / ssh* commands / (ftp too :) )
r* commands are easy to do. Check the return type and process id return from there so that we can control. And more execute them as in background so that you can automate it in parallel mode.
Suppose to know about the vmstat informations then,
--- test.data --
# remote hostnames
export SERVER="test find"
----- test.ksh ---
#!/usr/bin/ksh
set -x
vmstat=`which vmstat`
remsh=`which remsh`
remote()
{
set -A IP $SERVER
index=0
while [[ $index -lt ${#IP[*]} ]]
do
$remsh ${IP[$index]} -l root -n "$vmstat" > /tmp/information.${IP[$index]} &
sleep 1
PID[$index]=$!
let index=index+1
done
# Process completion check
# Check the process id availability usign the process id on PID array
You can simulate more.
HTH.
+Muthu+