- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Hang script
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-06-2001 07:09 AM
09-06-2001 07:09 AM
Example:
set systems= (client1 client2 client3)
foreach system ($systems)
remsh $system echo $shell
end
It hangs on client2. I can ping client2. I can't login because home is nfs mount. When I try telnet client2 it says trying ip...
How do I stop this hanging and goes to client3?
Sachin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:15 AM
09-06-2001 08:15 AM
Re: Hang script
if it is not sure, that your remsh command returns properly, you'll need to start it in background with "&"
and record PID of background process (man csh).
After this "sleep secs_long_enough"
After this check if PID still active and if yes, kill it and take a status-note.
Porceed to next loop then.
I am no csh-fan, so I have limits to give you a sample, but this should lead the way.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:19 AM
09-06-2001 08:19 AM
Re: Hang script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:21 AM
09-06-2001 08:21 AM
Re: Hang script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:24 AM
09-06-2001 08:24 AM
Re: Hang script
#!/usr/bin/sh
cd /home/richard/cron
HOSTNAME_FILE=hostnames
for host in $(cat $HOSTNAME_FILE)
do
echo $host
remsh $host -l root hostname
done
#### end of script
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:40 AM
09-06-2001 08:40 AM
Re: Hang script
compile: cc -Aa killafter.c -o killuser
usage in your application:
killafter remsh echo $shell
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 08:45 AM
09-06-2001 08:45 AM
Re: Hang script
Improved version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 09:32 AM
09-06-2001 09:32 AM
SolutionYou could try something like this
=========Cut here==============
#!/bin/ksh
export systems = "client1 client2 client3"
for i in $systems
do
echo $i
(remsh $i -n "echo $SHELL") &
MYPID=$!
# echo $MYPID
sleep 5
ps -ef |grep -v grep |grep $MYPID >/dev/null 2>&1
if [ $? = 0 ]
then
echo "Connection to client $i is hung"
kill $MYPID
fi
done
=========Cut here==============
-HTH
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 09:51 AM
09-06-2001 09:51 AM
Re: Hang script
I have a script that runs command1 and that commnad1 remsh for multiple systems.
I will grep for command1's pid and then I will search for child pid of that pid and kill it if it hangs more then 5 seconds.
R.U your solution is very much what I was looking for.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 10:28 AM
09-06-2001 10:28 AM
Re: Hang script
Attached is a script to ping a list of hosts from a file formatted like /etc/hosts, and specify how long to wait before giving up and killing the process. It uses the shell's ability to return a background PID.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 12:15 PM
09-06-2001 12:15 PM
Re: Hang script
# what /usr/sbin/ping
/usr/sbin/ping:
PHNE_16158 ping.c $Revision: 1.8.119.5 $ $Date: 98/07/23 14:27:01 $
NET: Version: B.11.00 $Date: 97/10/15 10:44:23 $