HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to check processes from a PERL program?
Operating System - HP-UX
1832964
Members
2463
Online
110048
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
04-22-2004 09:26 AM
04-22-2004 09:26 AM
Hello colleagues,
I'm new to PERL (even if I'm 41)
then I need some help to do my 1st program.
In my PERL program I fork several children, and I want to keep them under control, i.e. I want to know if they are still running at a certain moment.
I want to be as much efficient as possible.
I'd like to avoid "system" or ' ' calls.
Is there any PERL call to check a process PID?
Or can I receive a signal when a child dies?
thanks for any help
Enrico
I'm new to PERL (even if I'm 41)
then I need some help to do my 1st program.
In my PERL program I fork several children, and I want to keep them under control, i.e. I want to know if they are still running at a certain moment.
I want to be as much efficient as possible.
I'd like to avoid "system" or ' ' calls.
Is there any PERL call to check a process PID?
Or can I receive a signal when a child dies?
thanks for any help
Enrico
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2004 09:38 AM
04-22-2004 09:38 AM
Solution
When you fork(), you should capture the PID of each child process. Then to determine is the process is still running, one easy method
is
$rslt = kill 0,$child_pid;
if ($rslt)
{
print "Child ",$child_pid," is still running.\n";
}
Signal handling is easy too:
sub child_process
{
print "Child sent signal\n"
return(-1)
}
$SIG{TERM} = \&child_process;
Now if the child sends a SIGTERM to the parent pid the parent can act on it.
is
$rslt = kill 0,$child_pid;
if ($rslt)
{
print "Child ",$child_pid," is still running.\n";
}
Signal handling is easy too:
sub child_process
{
print "Child sent signal\n"
return(-1)
}
$SIG{TERM} = \&child_process;
Now if the child sends a SIGTERM to the parent pid the parent can act on it.
If it ain't broke, I can fix that.
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
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP