- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Hoe to run execute a script from one trusted s...
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
Forums
Discussions
Discussions
Discussions
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
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
09-14-2008 08:55 AM
09-14-2008 08:55 AM
I our datacenter we are having lot of servers.I need to fetch some information from all the servers, we are having one server from which we can login without passwd. I need to execute the script from this box in other Solaris and HPUX boxes. Can you please tell me the steps to execute this script and get it mailed to my email id.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:34 AM
09-14-2008 09:34 AM
Re: Hoe to run execute a script from one trusted server to all servers
Any configuration you introduce that means all your systems trust just one server can be a major security issue - is that something you really want to do? Assuming it is, you'll find plenty of data on the forums for setting up ssh without requiring password access, just search for ssh
Here's one recent example:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1223480
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:48 AM
09-14-2008 09:48 AM
Re: Hoe to run execute a script from one trusted server to all servers
#ssh goldman bdf
This gives me the output. But tell me the way to run the script using ssh. And get the output file emaild to my email id.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:56 AM
09-14-2008 09:56 AM
Re: Hoe to run execute a script from one trusted server to all servers
#ssh goldman bdf
>But tell me the way to run the script using ssh. And get the output file emailed to my email id.
Basically you redirect the output then mail it:
ssh goldman bdf > log.out 2>&1
mailx -s "output of script" abc@def.com < log.out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 10:03 AM
09-14-2008 10:03 AM
Re: Hoe to run execute a script from one trusted server to all servers
I want to execute the script located on the server from which i am doing ssh to the other host.For example
My script hpux.script is located in the server A at /tmp/hpux.sh location. Now i want to execute this script on server B.
Please tell me the way to execute this script remotely. If i put this script in Server B and then i run the following command:
#ssh goodman /tmp/hpux.sh
Then I am able to get the output. But I do not want to put this file in server B. Please tell me the way to run this script from server A without putting it in server B.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 10:28 AM
09-14-2008 10:28 AM
Re: Hoe to run execute a script from one trusted server to all servers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 10:38 AM
09-14-2008 10:38 AM
Re: Hoe to run execute a script from one trusted server to all servers
> without actually putting the script on
> ServerB.
NFS?
It would be more reliable to run a local
script than a remote script, but file sharing
is pretty common these days, isn't it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 10:43 AM
09-14-2008 10:43 AM
Re: Hoe to run execute a script from one trusted server to all servers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 11:46 AM
09-14-2008 11:46 AM
Re: Hoe to run execute a script from one trusted server to all servers
run a script on server B, but you don't want
server B to have any local or remote access
to the script?
Were you expecting server B to use telepathy?
Do you have any actual reasons for imposing
these apparently senseless constraints on the
solution to your problem, or is this a game?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 12:00 PM
09-14-2008 12:00 PM
Solutionscp /tmp/hpux.sh goldman:/tmp
ssh goldman /tmp/hpux.sh >> /myoutput.txt
etc...
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 12:19 PM
09-14-2008 12:19 PM
Re: Hoe to run execute a script from one trusted server to all servers
Wouldn't that put the script on the
destination server, where we've been told it
can't be?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 12:21 PM
09-14-2008 12:21 PM
Re: Hoe to run execute a script from one trusted server to all servers
You are asking for no end of problems if your script is complicated and you'll need to justify to us why you want to do such a thing.
>If I put this script in Server B and then I run the following command:
#ssh goodman /tmp/hpux.sh
>Then I am able to get the output.
Right, this is the way everyone would expect to do this.
>Please tell me the way to run this script from server A without putting it in server B.
If you insist, you'll need to change just about every line in your script to use:
ssh goodman -c "command; command"
You might get away with using a here document:
ssh goodman <
command
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:46 PM
09-14-2008 09:46 PM
Re: Hoe to run execute a script from one trusted server to all servers
For run the script into every server 1st you need to add all server names into one file suppose file name is /tmp/srvlist in this file just add all the server name like
server1
server2
server3
save the file and come out
now open other file like /tmp/main.sh
for i in `cat /tmp/srvlist`
do
ssh $i /home/yourscript.sh
done
save the file main.sh
before run main.sh ensure that you have copied yourscript.sh into /home in those 3 server
now run the script ./tmp/main.sh
enjoy
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2008 07:45 AM
09-15-2008 07:45 AM
Re: Hoe to run execute a script from one trusted server to all servers
which is what he DOESN'T want to do.
since you've got passwordless login, the following will work, but you will get the login messages in your log:
=================================
File svr.list:
s1
s2
s3
=================================
Script1, on local machine only:
for svr_name in `cat svr.list`
do
/Script2 2> /dev/null >> /path-to-local-log
done
=================================
Script2, on local machine only:
ssh $svr_name <
echo
echo "This hp-ux Box"
echo
echo
PATH=/usr/sbin:/bin:/sbin:/usr/bin
uname -a
bdf
cat /etc/fstab
ifconfig lan0
ifconfig lan1
ifconfig lan2
ifconfig lan3
uptime
/opt/ignite/bin/print_manifest
netstat -rn
cat /stand/system
ls -ld /etc/hostna*
cat /etc/hosts
echo
echo
echo
echo
echo "#########################################"
echo "# Script Finished #"
echo "#########################################"
EOF
====================================================
Note the location of the log is determined when "Script2" is run. You will get the various login messages in the file...How you deal with that is up to you.