HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- scripting a background process
Operating System - Linux
1827896
Members
1850
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
06-28-2007 12:17 PM
06-28-2007 12:17 PM
Hello everyone,
I am writing a script that works perfectly in the fore ground. The script starts a background process that monitors the parent process so that it knows when it is done. The background process writes time updates to the screen so that the user knows that the parent process is still running. The problem I am having is that if I try to run the parent script in the background I get a SIGTTOU message and the script stops until I bring it back into the fore ground.
I know the problem is with the script trying to write to the crontroling tty and it can't but I am not sure if there is a way around it. Does any one have any ideas?
I hope this all made sense!!
Thanks,
Tim
I am writing a script that works perfectly in the fore ground. The script starts a background process that monitors the parent process so that it knows when it is done. The background process writes time updates to the screen so that the user knows that the parent process is still running. The problem I am having is that if I try to run the parent script in the background I get a SIGTTOU message and the script stops until I bring it back into the fore ground.
I know the problem is with the script trying to write to the crontroling tty and it can't but I am not sure if there is a way around it. Does any one have any ideas?
I hope this all made sense!!
Thanks,
Tim
Solved! Go to Solution.
- Tags:
- background
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 01:12 PM
06-28-2007 01:12 PM
Solution
Add a trap to the writing process telling it to ignore SIGTTOU.
bear in mind that there is another better way to determine if a background process is still running.
child_proc.sh &
CHILD_PID=${!}
Now periodically do
kill -0 ${CHILD_PID}
CHILD_STAT=${?}
if [[ ${CHILD_STAT} -eq 0 ]]
then
echo "The kid is still running"
fi
bear in mind that there is another better way to determine if a background process is still running.
child_proc.sh &
CHILD_PID=${!}
Now periodically do
kill -0 ${CHILD_PID}
CHILD_STAT=${?}
if [[ ${CHILD_STAT} -eq 0 ]]
then
echo "The kid is still running"
fi
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 01:15 PM
06-28-2007 01:15 PM
Re: scripting a background process
Thanks Clay!
This makes total sense and probably more efficient.
Tim
This makes total sense and probably more efficient.
Tim
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP