sub Startup { report("Info: $Config{ServiceName} Starting"); Initialize(); while (ContinueRun()) { # EVENT LOOP if ($shared_memory_server) { # Maintain Worker Threads $shared_memory_server->service_worker_procs(); # Service Unique Id Requests $shared_memory_server->service_unique_id_requests(); # Reap Old Results Out Of The System if (sleptfor("reap_old_results",10)) { $shared_memory_server->reap_old_results(); } if (sleptfor("reload_config",60)) { if ((-M "$base_dir\\Mail_Daemon.conf") < $config_file_ +modify_info) { $config_file_modify_info = (-M "$base_dir\\Mail_Da +emon.conf"); report("Info: $Config{ServiceName} Configuration U +pdated ... Reloading"); $shared_memory_server->reload_configuration(); } } if (sleptfor("read_status",5)) { if ($shared_memory_server->read_directive() eq "DIE") +{ $shared_memory_server->set_directive("DIE_PROCS"); # Need To Wait For All Processes To Die Before Dyi +ng Myself report("Info: $Config{ServiceName} Killing Myself +... Waiting For Workers To Die"); $proc_kill_timeout = time + 30; while (not $shared_memory_server->no_workers_left( +)) { # Put check in here ... if the procs are not d +ead with 30 seconds # kill forcefully Win32::Sleep(500); if (time > $proc_kill_timeout) { report("Info: $Config{ServiceName} Process +es Hung ... Hard Killing Processes"); $shared_memory_server->DESTROY(-1); } } report("Info: $Config{ServiceName} All Processes D +ead. Exiting"); exit; } } Win32::Sleep(100); } } # Report how long the service is going to take to close PerlSvc::ReportStatus(PerlSvc::SERVICE_STOP_PENDING(), 35); report("Info: $Config{ServiceName} Stop Request Granted ... Waitin +g For Workers To Die"); $shared_memory_server->set_directive("DIE_PROCS"); $proc_kill_timeout = time + 30; while (not $shared_memory_server->no_workers_left()) { # Put check in here ... if the procs are not dead with 30 seco +nds # kill forcefully Win32::Sleep(500); if (time > $proc_kill_timeout) { report("Info: $Config{ServiceName} Processes Hung ... Hard + Killing Processes."); $shared_memory_server->DESTROY(-1); } } report("Info: $Config{ServiceName} Stopping"); exit; }
In reply to Re: Re: PerlSvc Ends With Error 1067
by lamberms
in thread PerlSvc Ends With Error 1067
by lamberms
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |