- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- About a script to login using remsh and take upt...
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
11-12-2008 09:42 AM
11-12-2008 09:42 AM
About a script to login using remsh and take uptime etc
I am trying a script which will do the following:
remsh hostname and redirect the output to a log file.
uptime and redirect to log file
and exit
then try the same for the next host.
But i could not give exit in the script itself. it is asking interactively.
How can i automate exit in the script itself.
Please help.
remsh
It needs manual intervention to get "exit".
But i need to automate it. Please help.
regards,
sanwin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2008 09:53 AM
11-12-2008 09:53 AM
Re: About a script to login using remsh and take uptime etc
for HOST in host1 host2 host3
do
remsh ${HOST} -n uname -a
done > /var/tmp/myhostlog
See the manpages for 'remsh' for more information. Using a secure shell is also safer.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2008 09:59 AM
11-12-2008 09:59 AM
Re: About a script to login using remsh and take uptime etc
I have to get the console output in a log. I mean i need to log the remsh
remsh
Hope you are getting the point.
it is something like
i do remsh hostname
and do uptime cmd and do exit
and copy the terminal output to a log file.
regards,
sanwin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2008 10:09 AM
11-12-2008 10:09 AM
Re: About a script to login using remsh and take uptime etc
ssh hostname "uname -a; uptime" >> uptime.log
You can test it with:
#ssh localhost "uname -a; uptime"
until you get desired results.
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2008 02:21 PM
11-12-2008 02:21 PM
Re: About a script to login using remsh and take uptime etc
That's correct, you just get the output of that command. No need to give "exit".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2008 08:57 PM
11-12-2008 08:57 PM
Re: About a script to login using remsh and take uptime etc
We are using this script to check the uptime
host=`ssh testbox hostname`
upt=`ssh testbox uptime |awk {'print $3" "$4" "$5'}|sed -e 's/,//' -e 's/,//'`
echo Hostname :$host Uptime : $upt
suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2008 06:33 AM
11-13-2008 06:33 AM
Re: About a script to login using remsh and take uptime etc
just for your interest:
The commands 'rup' and 'ruptime' provide such remote information, if the corresponding daemons are running.
Look at the man pages.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2008 07:04 AM
11-13-2008 07:04 AM
Re: About a script to login using remsh and take uptime etc
But I'm guessing it's something like this you want?
#!/bin/bash
host=$@
# Commands seperated by a ;
commands="uptime;uname -a"
logfile="/path/to/logfile"
for thishost in $host; do
IFS=";"
for cmd in $commands; do
run="remsh $thishost -n \"$cmd\""
echo "$run" >> $logfile
$run >> $logfile
done
IFS=" "
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2008 01:02 AM
11-20-2008 01:02 AM
Re: About a script to login using remsh and take uptime etc
thanks for your reply.
The requirement is something like:
it needs to log all the things that are seen when we do either remsh or ssh.
I need the warning and shell prompt to be logged and then the execution of the commands and their output to be logged.
please let me know if any help.
regards,
sanwin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2008 01:23 AM
11-20-2008 01:23 AM
Re: About a script to login using remsh and take uptime etc
When you execute the login it will just return the output from your "shell".
Unless (maybe, not entirely sure this is possible.) you execute some kind of script locally on the machine I can't see that you can get an "interactive look" from the procedure.
Probably someone with abit more knowledge about interactive shell handling can tell you some more about the possibilities :)
Best regards
Fredrik Eriksson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2008 01:31 AM
11-20-2008 01:31 AM
Re: About a script to login using remsh and take uptime etc
>I need the warning and shell prompt to be logged
Since these don't show up with remsh or ssh when you do a single command, you can't very well log them.
Using a here document with ssh will show the banner and prompt. But remsh just gives: Closed connection.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2008 01:40 AM
11-20-2008 01:40 AM
Re: About a script to login using remsh and take uptime etc
I really did get what you are trying to say " using document here with ssh"
Could not get the point.
Is there any option available in ssh to fill the requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2008 01:49 AM
11-20-2008 01:49 AM
Re: About a script to login using remsh and take uptime etc
I said "Using a here document":
ssh machine <
EOF
http://en.wikipedia.org/wiki/Heredoc