Hello All,
I'm facing a issue where the my perl script is unable to catch the
signals. The below code I had got it from one of the site. I run this
script and kill using HUP signal from another window, so that it
catches it and does the necessary action.
The issue is on adding the module Sybase::CTlib it doesn't catches the
signal. On commenting it, the program works absolutely fine i.e it
catches the signal and run subroutine reload.

Does anybody face this issue or have any idea about it what's going
wrong with the below code. Why on specifying the module Sybase::CTlib
its not catching the signal.


#!/usr/bin/perl
############################################################
# This is a sample program that shows how you can catch
# signals to your program when running as a deamon
#
############################################################

$SIG{HUP}=\&reload;

use Sybase::CTlib;
#use Sybase::DBlib;

print "New PID - $$\n";

while(1) {
    # do your deamon work here
    sleep(1);

}

# refresh the config info and continue processing
# this method will be called if the following signal is given to your
pid
# kill -HUP
sub reload() {
    print "Caught a HUP signal, reload config files and   continue
processing\n";
    exit(0);
}

# close all file handles and do any other clean up
# this method will be called if the followng signals are given to your
pid
# kill -INT
# kill -ABRT
# kill -QUIT
# kill -TERM
sub cleanAndExit(){
    print "Caught a kill signal, cleaning up and  exiting\n";
    exit(0);
}


Thanks a lot.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to