- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sleep commands fail
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
10-05-2006 10:02 AM
10-05-2006 10:02 AM
sleep commands fail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 10:14 AM
10-05-2006 10:14 AM
Re: sleep commands fail
However, whenevet I see sleep in association with multiple processes as a 'sync' method, a red flag goes up. It will eventually fail because it is incredibly simplistic and inreliable. It assumes that the processes will always take the same time to run and of course, your processes aren't running as expected.
Start with tracing the process that is taking too long. Is it full of errors and completely failing? You need a method to bail out, report the errors and signal the dependent processes not to start or continue. Also read the man page for the command designed to handle this type of situation:
man wait
But better yet is to communiate interprocess status with a common file. When processes have completed, they write a message to the file.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 10:17 AM
10-05-2006 10:17 AM
Re: sleep commands fail
From sleep man page:
sleep exits with one of the following values:
0 The execution was successfully suspended for time seconds, or a SIGALRM signal was received.
>0 If the time operand is missing, is not a decimal integer, is negative, or is greater than UINT_MAX, sleep returns with exit status 2.
Yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 11:11 AM
10-05-2006 11:11 AM
Re: sleep commands fail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 11:48 AM
10-05-2006 11:48 AM
Re: sleep commands fail
getconf UINT_MAX
The value for UINT_MAX is 4294967295 so:
# sleep 4294967296
sleep: illegal argument
and
# sleep -2
sleep: illegal option -- 2
usage: sleep time
However, sleep actually ignores any number larger than 2147483647 up to 4294967295 causes sleep to immediately return with no error code.
Unless you trace the script, you won't be able to determine where the error code was generated until you trace the script. Add the command set -x at the front of the script and make sure stderr is redirected into a logfile.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 02:13 PM
10-05-2006 02:13 PM
Re: sleep commands fail
As suggested, you will probably be far better served by setting up some sort of lock file to coordinate the processes or some sort of sockets-based semaphore server if this must be coordinated across multiple hosts. The sleeps simply cannot cope with expected events such as seeming spurious signals or processes that take atypical amounts of time to complete.