- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script hanging
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
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
04-15-2004 06:20 AM
04-15-2004 06:20 AM
Script hanging
What I wanted to add was the ability to log the entire script run. The general syntax of the script is:
#!/sbin/sh
(
if [ -f /onsite ];
then
else
fi
) | tee -a ${LOGFILE}
All of the commands execute, the script just doesn't exit. If I take the pipe to tee out, it exits fine, even with the subshell wrapped around the commands. I tried putting an explicit exit at the end of the subshell, but it still hung.
The odd part is that another script I have that I added the "() | tee" wrapping in functions perfectly well and exits normally as it should.
Bug? feature? Something subtle I'm just being clueless about?
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:27 AM
04-15-2004 06:27 AM
Re: Script hanging
#!/sbin/sh
set -vx
(
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:32 AM
04-15-2004 06:32 AM
Re: Script hanging
Ok... I added an explicit exit at the end of all the commands in the if and the else... it exited. Fine and dandy except, out of curiosity, I took them back out and left it with the original syntax... and it appears to be exiting consistently that way too now. Hmmm. Some days...
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:46 AM
04-15-2004 06:46 AM
Re: Script hanging
#!/sbin/sh
(
if [ -f /onsite ];
then
echo "Done with configs"
else
fi
echo "Out of the if statement"
) | tee -a ${LOGFILE}
It prints both messages so everything is completing within the subshell, but for some reason simply isn't exiting.
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 07:53 AM
04-15-2004 07:53 AM
Re: Script hanging
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=24111
Though it's dealing with tee hanging when the poster was trying to spawn background processes from his script, the symptom is exactly the same as what I'm seeing. Since I'm starting NFS, as elaborated below, with the init scripts, I suppose it could be open file descriptors as Steve Steel mentioned there, but I don't see why it would hang sometimes and not others (seemingly randomly) if that was the case.
#!/sbin/sh
(
if [ -f /onsite ];
then
/sbin/init.d/nfs.core start
/sbin/init.d/nfs.client start
/sbin/init.d/nfs.server start;
else
fi
) | tee -a ${LOGFILE}
I'm trying to change it so the NFS scripts redirect their output to /dev/null (since I really don't care to see those messages). Will that be sufficient to guarantee closing the pipe or am I not getting the full gist of Steve Steel's explanation?
Jeff Traigle