Steven Manross wrote:
We're going to need to see the code for winupdate_local.pl because that's where Windows says the problem is. If that's not possible, look at dirmon.pl from:
http://www.roth.net/perl/scripts/scripts.asp?DirMon.pl
That has the install stuff in it and is the service code as well (you have the state-checking while loop in your service script.. right?).
Use that as a baseline to troubleshoot the error.
It's a very basic sercice once you realize that all you really need for your service is the main code and the while loop checking the Service State at the root, and then you're ready to do most anything as a service, providing your code lets itself return out to the while loop occasionally to check the state again in case someone's trying to stop the service (or check the state from within your code, and return out if a service stop is being requested).
Thank you for pointing me to that. After I read your reply I grabbed my copy of Dave's Win32 Perl Scripting Handbook, and I found out what I was missing. My fault was, that I just wrote a script and thought installing it is enough to get it to work. I added my script to the script in Example 8.7 and finally it works!
Thanks a bunch for your help, I really appreaciate it.
Alex
Steven
-----Original Message----- *From:* Alexander Apprich [mailto:[EMAIL PROTECTED] *Sent:* Thu 10/30/2003 5:44 AM *To:* Steven Manross *Cc:* Alexander Apprich; [EMAIL PROTECTED] *Subject:* Re: Error while starting service
Hi Steven,
Steven Manross wrote: > I'm pretty sure that means you have a compile error (or at least that > happens to me when I have a compile error).. > > Run > > perl -c script.pl > > And fix any issues. :) >
C:\Programme\Serv-Int-Programme>perl -c winupdate_local.pl winupdate_local.pl syntax OK
When I start the script from command line it runs fine. It's just running it as a service.
Alex
> Steven > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Alexander Apprich > Sent: Wednesday, October 29, 2003 5:44 AM > To: [EMAIL PROTECTED] > Subject: Error while starting service > > > Hi there, > > I got stuck again. I wrote the follwoing script to install a perl script > as a service. Install/Uninstall works fine, but I'm not able to start > the service. The Error Code I run into is 2186 (I'm working on a german > Win2K-Box so please see "net helpmsg 2186" for details :-)). > > As you can see I try to run the service as a different user then > Admininstator. > > Any help/hint is greatly appreciated! > > Alex > > # Interpreter: C:/Programme/Perl/bin/perl.exe > > use Win32::Daemon; > > $sidir = "C:\\Programme\\Serv-Int-Programme"; > $file = "$sidir\\winupdate_local.pl"; > $Machine = "\\\\" . Win32::NodeName(); > Win32::Daemon::Timeout( 90 ); > > %ServiceConfig = ( > name => 'scwinupdate', > display => 'sc Windows Update Service', > path => 'C:\\Programme\\Perl\\bin\perl.exe', > user => '.\serv-int', > password => 'perl', > parameters => $file, > depedencies => [], > ); > > if ($installflag eq "i") { > > if ( Win32::Daemon::CreateService( \%ServiceConfig ) ) { > print "$ServiceConfig{display} successfully installed\n"; > }else{ > print "$ServiceConfig{display} could not be installed\n"; > print "Error: "; > print Win32::FormatMessage( Win32::Daemon::GetLastError() ), "\n"; > } > }elsif ($installflag eq "u" ) { > if ( Win32::Daemon::DeleteService( $Machine, $ServiceConfig{name} ) ) > { > print "$ServiceConfig{display} successfully uninstalled\n"; > }else{ > print "$ServiceConfig{display} could not be uninstalled\n"; > print "Error: "; > print Win32::FormatMessage( Win32::Daemon::GetLastError() ), "\n"; > } > } >
-- _________________________________creating IT solutions Alexander Apprich science + computing ag IT-Services Hagellocher Weg 71-75 phone +49(0)7071 9457-291 D-72070 Tuebingen, Germany fax +49(0)7071 9457-211 www.science-computing.de
-- _________________________________creating IT solutions Alexander Apprich science + computing ag IT-Services Hagellocher Weg 71-75 phone +49(0)7071 9457-291 D-72070 Tuebingen, Germany fax +49(0)7071 9457-211 www.science-computing.de
_______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
