- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script timeout parameters
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
07-16-2001 09:29 AM
07-16-2001 09:29 AM
script timeout parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2001 09:37 AM
07-16-2001 09:37 AM
Re: script timeout parameters
It is depends on your script.
for example if you doing remsh from your script it will generally timeout after couple second.
You have to put checking in you script for example that frist you want to display date only 10 times then do task 2 if task 2 fails or if result from task 2 is none after 5 minute then report the error and go on for task 3 or exit from script.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2001 09:55 AM
07-16-2001 09:55 AM
Re: script timeout parameters
There are various ways to do what you want.
You can create background processes, monitor them and kill them after a predetermined time if they have not completed. The monitoring can be done using the PID of the background process and a 'kill -0' to test if its still a valid PID.
If you are reading input from 'stdin', the 'line' command has a timeout feature. The command reads one line (up to a newline) from stdin. If nothing is read after (t)imeout then a null string is returned:
#!/usr/bin/sh
while true
do
echo "...reading..."
WHAT=`line -t 5` #...give user 5-seconds to respond
if [ ! -z "$WHAT" ]
then
echo "I read: $WHAT"
fi
done
#.end.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2001 10:08 AM
07-16-2001 10:08 AM
Re: script timeout parameters
No the command while block all year until completed. Even's James' suggestion of test with kill -0 pid is not foolproof because on these time scales pid's are recycled.
In your case you could simply do this:
cmd1 &
cmd2 &
cmd3 &
cmd4 &
cmd5 &
wait
This will start all of the commands in background but the script will not exit until
all the background processes complete.
If cmd2 must wait until cmd1 completes but the others can run asynchrously, you could do this:
(cmd1; cmd2) &
cmd3 &
cmd4 &
cmd5 &
wait
If you want really good timeout (alarm) and other signal handlers from a scripting language probably your best bet is perl.
My 2 cents, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2001 10:21 AM
07-16-2001 10:21 AM
Re: script timeout parameters
I agree with Clay that one would not want to let long periods of time elapse and then arbitrarily test the vailidity of a PID.
What I meant was a case where you initiate your process in the background; capture its PID using the "$!" variable; and in a loop sleep for a short time (in seconds); waken; test the captured PID; continue if done; or return to the loop until done.
Regards!
...JRF...