This message I posted yesterday but got now answer except some out of office replies. Maybe my Question was not clear. My Question is: why does the script not fire if it runs as service ?
With this module I monitor changes in a directory: ---------------------------------------- &mailprot("Monitoring started"); $WatchSubTree = 1; $Events = 'FILE_NAME'; Win32::ChangeNotify::FindFirst($monitor, $MonDir, $WatchSubTree, FILE_NOTIFY_CHANGE_FILE_NAME ); while ($monitor->FindNext()) { $monitor->Wait( INFINITE ); # sleep(300); $Inhalt = ""; if (! opendir (BKDIR, "$MonDir")) { &mailprot("can't opendir $MonDir:\n $!\n"); } while (defined ($fname = readdir(BKDIR))) { next if $fname =~ /^\.$/; next if $fname =~ /^\.\.$/; next if $fname =~ /@ReadMe\.htm/i; next if $fname =~ /^Bitte Version und Sprache/i; $Inhalt = "${Inhalt}\n$fname"; } close BKDIR; &mailprot("Aenderungen im Briefkasten:\n$Inhalt"); } END{ &mailprot("Monitoring stopped"); } exit 0; -------------------------------- I compiled the program with perl2exe to an exe file. If I start the program from comand line all works fine. If it runs as service I get the start message (see first line in script) but no message if something changes in the monitored directory. The service was created as described in Dave Roth's Book 'Win32 Perl Scripting', Page 274 in the following way: instsrv.exe "Monitor" C:\WIN_NT\system32/srvany.exe Modifying the registry was not as described in the book. I had to create the Parameters key. Should the key not be there already ? That's what I now have in the registry: 'Monitor' has the keys Enum, Parameters, Security Parameters has the String Values: Application REG_SZ Path to my exe file AppParameters REG_SZ (Default) REG_SZ (Value not set) If I start or stop the service I get the start or stop message by mail but if I create or delete a file in the monitored directory I get no message. Why ? Environment: Win2000 (upgrade from NT) SP4 ActiveState perl 5.6.1.623 Win32::ChangeNotify 1.02 Michael -- Michael Meltzer AED-SICAD AG Lilienthal-Str. 7 D-85579 Neubiberg Tel.: +49 89 45026 108 Fax: +49 89 45026 113 [EMAIL PROTECTED] http://www.aed-sicad.de/ _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs