- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Perl daemon question
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
Discussions
Discussions
Forums
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
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-04-2005 12:26 AM
тАО10-04-2005 12:26 AM
Perl daemon question
i wrote small useful (only for me :) perl daemon, but I can't adjust its behaviour for signal HUP. I know i can ignore signal by setting...
$SIG{HUP} = 'IGNORE'
, but I need execute my procedure. If i set...
$SIG{HUP} = \&catch_signal
then the procedure is executed, but then it is finished with...
Interrupted system call at ./x.pl line...
Is there any possibility to "mask" the signal a nd execute my procedure only?
Thanks for any help
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 12:33 AM
тАО10-04-2005 12:33 AM
Re: Perl daemon question
sub catch_signal {
print("Got HUP signal!\n");
}
$SIG{HUP} = 'catch_signal'
for ($x = 0; $x < 10; $x++) {
print("$x\n");
sleep 1;
}
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 12:35 AM
тАО10-04-2005 12:35 AM
Re: Perl daemon question
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 12:37 AM
тАО10-04-2005 12:37 AM
Re: Perl daemon question
#!/usr/contrib/bin/perl
sub INT_handler {
print("Don't Interrupt!\n");
}
$SIG{HUP} = 'INT_handler';
for ($x = 0; $x < 10; $x++) {
print("$x\n");
sleep 10;
}
# ./tst.pl &
[1] 26431
# 0
# kill -1 26431
Don't Interrupt!
1
hth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 01:01 AM
тАО10-04-2005 01:01 AM
Re: Perl daemon question
You can check torso of my script...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 06:24 PM
тАО10-04-2005 06:24 PM
Re: Perl daemon question
Note: Post this scripting related in hp-ux so that you will more really faster responses.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 11:42 PM
тАО10-04-2005 11:42 PM
Re: Perl daemon question
have you had a look at "perldoc perlipc" yet?
There are plenty of short signal handler sample codes.
Also regard the warning note in perlipc about not re-entrant system libraries.
At least prior to Perl 5.8 signal handlers should implement as little (clean-up) action as possible.
Btw. it's better to stick to your usage of sub refs (i.e. the \& form) than the use of symbolic refs of Muthu
(although if you didn't use strict 'refs', and stayed in the same package scope you probably wouldn't notice a difference).