Hi,
I'm using win32 daemon to run a script as a service. I'm collecting data
from perfmon, then I want to sleep for a minute, and repeat the collection.
When I sleep for 60 secs, I can't stop the service.  I get 'the service
could not be stopped' or 'the service is not responding to the control
function'. If I bump the sleep down to say, 10 secs, I can stop and start
it at will.

I assume the sleep(60) is causing the problem? Can anyone suggest a better
way of doing the same thiing?
Thanks for any suggestions.... I've included a portion of the script below.

Chris
[EMAIL PROTECTED]


The way I have my script structured right now is as follows:
elsif( SERVICE_RUNNING == $State )
    {
        # The service is running as normal...

            sleep(60);
            $perf = new Win32::PerfLib($machine);
            Get_CPU_Data();

            Get_Disk_Space();
            Get_Net_Card_Data();
            Get_Net_Segment_Data();
            $perf->Close();

       $PrevState = SERVICE_RUNNING;

    }# end elsif

    else
       #some unknown state, reset service to last known state -

    {
         Win32::Daemon::State( $PrevState );
            sleep( 10 );
    }# end else

}# end  While
Win32::Daemon::StopService();

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

Reply via email to