Hi Deb,

try using Dave Roth's Win32::Daemon - it works great for me. The only thing
is that you have to extend your script to get all the features of this
module.

Here is an example:

# Define how long to wait before a default status update is set.
Win32::Daemon::Timeout( 5 );

# Start the service...
if( ! Win32::Daemon::StartService() )
{
     exit();
}

while( SERVICE_STOPPED != ( $State = Win32::Daemon::State() ) )
{
     if( SERVICE_START_PENDING == $State ) {
          # your code comes here
     } elsif( SERVICE_PAUSE_PENDING == $State ) {
          # "Pausing..."
          # your code comes here
          Win32::Daemon::State( SERVICE_PAUSED );
          next;
     } elsif( SERVICE_CONTINUE_PENDING == $State ) {
          # "Resuming..."
          # your code comes here
          Win32::Daemon::State( SERVICE_RUNNING );
          next;
     } elsif( SERVICE_STOP_PENDING == $State ) {
          # "Stopping..."
          # your code comes here
          Win32::Daemon::State( SERVICE_STOPPED );
          next;
     } elsif( SERVICE_RUNNING == $State ) {
          # The service is running as normal...
          }
          # here comes your main code...
     }
     sleep(1);
}

Win32::Daemon::StopService();

Hope this works for you !

Best regards

Christian Kirn
                                              
                                              
                                              
                                              
                                              
 Group-Consult GmbH    Fon. +49 (7524) 915590 
                                              
 Schwalbenweg 4        Fax. +49 (7524) 915595 
                                              
 D-88339 Bad Waldsee   e-mail                 
                       [EMAIL PROTECTED] 
                       info                   
                       www.group-consult.de   
                                              


message sent by Group-Consult GmbH

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to