Re: Error 1053 starting Win32::Daemon service
Andrew McLaren wrote: > Mark, Michael,Thanks for the ideas. The account that this defaults to if the > -user parameter is not used, is shown in the SCM as the Local System > account.First up, tried installing this with fully qualified -l, -d and -t > parameters, but no change. I didn't really expect anything dramatic here > because the defaults generated by DIRMON looked pretty valid.Next up, added > the redirection of stderr in a BEGIN block (good idea!). However, no luck > there, as nothing is ever written to the log file. In fact, the log file is > only created on the install, but if then removed, is not recreated when the > SCM attempts to start the service. It appears to me that it never gets as far > as loading the script.I can run the script interactively, but to tell the > truth, I'm not really sure what to expect when this is done. Is it then still > visible and controllable via the SCM? I suspect not, as the > install is what adds most of the SCM specific information. For what its > worth, the script appears to run once through its main service loop > (Daemon::State() first returns a state value of 0 which DIRMON treats as > unknown, then a STOPPED state (1) which causes it to exit.Andrew Regarding your first mail Andrew I had the same problems. So I was very interested in replies to your request from the list. Now I managed on Win2000 SP4 to monitor a local dir whithout specifying a user: perl dirmon.pl -install -d C:\Temp2 -l C:\monitor.log net start DirMon service was running, changes to the dir were logged. To monitor a remote dir I had to specify a user and pass: perl dirmon.pl -install -user -pass -d \\host\share\dir\ -l C:\monitor.log -t 20 net start DirMon at the first time I got an error message (which I forgot) but after some time the service was running ! and changes to remote dir were logged. hope this helps Michael > > > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Error 1053 starting Win32::Daemon service
try "installing" the service with complete requirements like perl dirmon.pl -install -d -l Michael [EMAIL PROTECTED] wrote: > My apologies if this ends up posted multiple times, but I > suspect the first attempt failed... > > Ive been having a battle getting a simple perl script to > start as a Win32 service (using Win32::Daemon) on XP. In > frustration Ive reverted to the DIRMON script from David > Roths website, which is touted as the example, and Im > having exactly the same problems with that. Methinks the > problem is with me, and a lack of something in the Win32 > knowledge department (my background is primarily VMS & > Unix) hopefully someone can point me in the right > direction. > > I have no problems installing the DIRMON script via a > simple > >perl DIRMON.pl install > > Ive done this without any account or other parameters, > but from looking at the installed service, it seems to add > sensible defaults. If I now try and start this through the > SCM, it immediately returns with > > Could not start the directory monitoring service on the > local computer > Error 1053: The service did not respond to the start or > control request in a timely fashion > > Thinking that this could be a privilege issue with running > outside an account context, Ive tried to start this with > an account and password > >perl DIRMON.pl install user xxx pass xxx > > I actually set up an account called xxx with the same > password, so this is literally what was entered. This > returns with; > > Failed to add the Directory Monitoring Service. > Error: The account name is invalid or does not exist, or > the password is invalid for the account name specified > > Ive then tried installing this as a system service, then > manually adding the account and password to the logon > details in the services console, and starting this again. > This still returns with the 1053 error above. > > I have found the SCM events logged for the startup > failures, and these are all of the form > > Timeout (3 milliseconds) waiting for the Directory > Monitoring Service service to connect. > > This implies that the SCM waited for 30 seconds for > something to happen, but in all cases I have seen the > failure was reported immediately the start request was > made > > What am I missing??? How do you debug problems at the > service level? > > Thanks for any help or pointers > > Andrew > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: second try - Win32::ChangeNotify
solved my problem ! found perl script dirmon.pl at dave roth's site. Thanks again for your advice and to mention dave roth's site. Michael Ñåðãåé ×åðíèåíêî wrote: > hello, Michael, > > Friday, August 05, 2005, 1:07:42 PM, You wrote: > > MM> If I start or stop the service I get the start or stop message by mail > MM> but if I create or delete a file in the monitored directory I get no > MM> message. > > MM> Why ? > > MM> Environment: Win2000 (upgrade from NT) SP4 > MM> ActiveState perl 5.6.1.623 > MM> Win32::ChangeNotify 1.02 > > I think it's not Win32::ChangeNotify issue. most likely service > not properly installed. And on Roth's site (roth.net) there is > module Win32::Daemon which can be used to install service > properly. hope this help You. > > MM> Michael > > -- > Ñ óâàæåíèåì, > Ñåðãåé mailto:[EMAIL PROTECTED] > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: second try - Win32::ChangeNotify
Thank you for your reply. I tryed Win32::Daemon but i don't know how to pause Wait( Infinite ) ? Michael Ñåðãåé ×åðíèåíêî wrote: > hello, Michael, > > Friday, August 05, 2005, 1:07:42 PM, You wrote: > > MM> If I start or stop the service I get the start or stop message by mail > MM> but if I create or delete a file in the monitored directory I get no > MM> message. > > MM> Why ? > > MM> Environment: Win2000 (upgrade from NT) SP4 > MM> ActiveState perl 5.6.1.623 > MM> Win32::ChangeNotify 1.02 > > I think it's not Win32::ChangeNotify issue. most likely service > not properly installed. And on Roth's site (roth.net) there is > module Win32::Daemon which can be used to install service > properly. hope this help You. > > MM> Michael > > -- > Ñ óâàæåíèåì, > Ñåðãåé mailto:[EMAIL PROTECTED] > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
second try - Win32::ChangeNotify
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 AGLilienthal-Str. 7 D-85579 Neubiberg Tel.:+49 89 45026 108Fax: +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
Win32::ChangeNotify
With this module I monitor changes in a directory: &mailprot("Monitoring gestartet"); $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 gestoppt"); } exit 0; I compiled the program whith perl2exe to an exe file. If I start the program from comand line all works fine but if it runs as service I get no message if something changes in the monitored directory but i get the start message (see first line in script) 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 ApplicationREG_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 ? Details: Win2000 (upgrade from NT) SP4 ActiveState perl 5.6.1.623 Win32::ChangeNotify 1.02 Michael -- Michael Meltzer AED-SICAD AGLilienthal-Str. 7 D-85579 Neubiberg Tel.:+49 89 45026 108Fax: +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
Re: sort question
"$Bill Luebkert" wrote: > Michael Meltzer wrote: > > > The following strings I have in an array: > > > > xyz > > abcd > > ZABC > > > > if I do @sorted = sort(@unsorted) I get > > > > ZABC > > abcd > > xyz > > > > I would like to sort this strings alphabetical ignoring capitalisation but > > whithout changing the output format. > > I want to get this: > > > > abcd > > xyz > > ZABC > > > > How can I do this ? > > Taken directly from sort func on perlfumc man page : > > # now case-insensitively > @articles = sort {uc($a) cmp uc($b)} @files; Sorry, I didn't reckon with this example in the man page. I looked in my perl books and didn't find it (needless to say ;) Thanks to all who answered ! Michael > > > -- > ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] > (_/ / )// // DBE Collectibles Mailto:[EMAIL PROTECTED] > / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ > -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
sort question
The following strings I have in an array: xyz abcd ZABC if I do @sorted = sort(@unsorted) I get ZABC abcd xyz I would like to sort this strings alphabetical ignoring capitalisation but whithout changing the output format. I want to get this: abcd xyz ZABC How can I do this ? Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: best practice question
Bill Curnow wrote: > On 21 Apr 2004 at 18:35, Michael Meltzer wrote: > > > a client sends data from internet to a server in an intranet. For > > security reasons this should be done by mail. Therefor a mailserver > > will be setup in DMZ. > > They're nothing secure about email, but I think I know what you're > getting at. You need a secure way of exposing a very small, very > limited part of your network to a single client. We do this all the > time using VPN tunnels, but that may be appropriate for you. is there a way to initiate a vpn connection with perl ? > > > Now, if you were planning on them sending the data in an encrypted > file attached to the email, then we're back to talking about email as > a secure medium. > > > yes, this is possible. I think this is a good solution. The only > > downer is that the initiative can not go from pop server when new mail > > arrives. But this is a problem of minor priority and can be solved by > > higher polling rate of the pop3 module. > > Yeah, we have several jobs that pole every seconds. It's a pain, but > sometimes keeping it simple involves a little pain. I found a Tool that could take the initiative: http://www.notifymail.com/ (was in a link from Erik Ableson) But the whole thing is not my project. Its a project of a customer of a colleg of mine. So I don't know which mailserver they will choose, which ports will go through the firewall and so on. I asked the list because i am subscribed to it. Anyway the information from the list was very helpful to see what's best practice is. Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: best practice question
Thank you for your help, I will have a look at it. Michael Huub Peters wrote: > I missed the Original Posting (it's probably in my job-mail) but > if your looking for a good free mail-server for Win32 I highly > recomend MailEnable: http://www.mailenable.com > The Standard version is a free, robust full fledged mail server > without ANY nags. > We use it in production and are very happy customers. > We now have 3 mail servers running (2 Standard, and 1 Pro > Version because of the extra features) > > Regards, > > Huub Peters > > - Original Message - > From: "Thomas, Mark - BLS CTR" <[EMAIL PROTECTED]> > To: "'Michael Meltzer'" <[EMAIL PROTECTED]>; "Perl-Win32-Users" > <[EMAIL PROTECTED]> > Sent: Wednesday, April 21, 2004 5:03 PM > Subject: RE: best practice question > > > > The mail server has to run on a windows box. Up to now there > > > is no specific server determined. So I am looking for a free > > > mail server (free of $) if possible. I would prefer a server > > > which can initiate the Perl program by itself as you stated below. > > > > Is launching perl program(s) the only reason for wanting a mail server? > > > > Do you have or can you set up an account somewhere you can check for the > > emails? If so, you could just use one of the POP3 or IMAP modules and > > retrieve email, taking whatever actions necessary. > > > > Otherwise you could use a mail server module like Net::Server::Mail to > > receive email and take what actions are necessary. > > > > If you need to handle regular mail users too in any volume, you'll > probably > > want to set up a real mail server (any that handle POP3 or IMAP clients > will > > do) and then poll it using a POP3 or IMAP module. > > > > > > -- > > Mark Thomas[EMAIL PROTECTED] > > Internet Systems Architect User Technology Associates, Inc. > > > > $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; > > > > > > ___ > > Perl-Win32-Users mailing list > > [EMAIL PROTECTED] > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: best practice question
"Thomas, Mark - BLS CTR" wrote: > > The mail server has to run on a windows box. Up to now there > > is no specific server determined. So I am looking for a free > > mail server (free of $) if possible. I would prefer a server > > which can initiate the Perl program by itself as you stated below. > > Is launching perl program(s) the only reason for wanting a mail server? yes the full scenario is: a client sends data from internet to a server in an intranet. For security reasons this should be done by mail. Therefor a mailserver will be setup in DMZ. > > > Do you have or can you set up an account somewhere you can check for the > emails? If so, you could just use one of the POP3 or IMAP modules and > retrieve email, taking whatever actions necessary. yes, this is possible. I think this is a good solution. The only downer is that the initiative can not go from pop server when new mail arrives. But this is a problem of minor priority and can be solved by higher polling rate of the pop3 module. > > > Otherwise you could use a mail server module like Net::Server::Mail to > receive email and take what actions are necessary. > > If you need to handle regular mail users too in any volume, you'll probably > want to set up a real mail server (any that handle POP3 or IMAP clients will > do) and then poll it using a POP3 or IMAP module. > > -- > Mark Thomas[EMAIL PROTECTED] > Internet Systems Architect User Technology Associates, Inc. > > $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; > Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: best practice question
Bill Curnow wrote: > On 21 Apr 2004 at 12:11, Michael Meltzer wrote: > > > How can I start a perlscript via mail on windows? An incoming mail > > should start the script and the script than will parse the mail. > > Unfortunately, you haven't provided enough information to make a > truly informed suggestion. sorry for that > > > 1) Is the mail server a Windows server, or do you simply want to run >the parsing client on a Windows server? The mail server has to run on a windows box. Up to now there is no specific server determined. So I am looking for a free mail server (free of $) if possible. I would prefer a server which can initiate the Perl program by itself as you stated below. > > > 2) Do you want (a) the mail server to initiate the Perl program, or >(b) do you want the Perl program to poll a POP3 or IMAP mailbox >looking for new email? > > 3) If you answered yest to 2a above, what mail server are you >running? Does it offer the option to run a program upon receiving >an email? > > Answer these questions and you'll be well on your way to answering > your original question. Thank you for your help Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
best practice question
How can I start a perlscript via mail on windows ? An incoming mail should start the script and the script than will parse the mail. Also the usage of some tools are possible. Any advice welcome Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
archive::zip problem
I wrote a little perl script to zip some textfiles on a windows box, send the archive via NET::FTP to a unix box and decrompress the archive there. On windows (NT) I can decrompress the archive with WinZip but on unix (SuSe 8.2 and Solaris 7) when running unzip I get the following error message: mich: unzip Container.zip Archive: Container.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of Container.zip or Container.zip.zip, and cannot find Container.zip.ZIP, period. the file command on Linux: mich: file Container.zip Container.zip: Zip archive data, at least v2.0 to extract here are the relevant parts of my program: use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $zip = Archive::Zip->new(); . foreach $box (@boxes) { print "$box\n"; ... $member = $zip->addFile( "document.$box"); } $status = $zip->writeToFileNamed( "Container.zip" ); &werror("040 Error while trying to zip\n$!\n", "2") if $status != AZ_OK; -- instead of addFile command in foreach loop I also tried $zip->addTreeMatching( '.', 'dir/*', 'document\.' ); after foreach loop with the same effect. I hope somone can help me. Thanks in advance Michael -- +-- Michael Meltzer -+-+ | AED-SICAD Aktiengesellschaft | EMail : [EMAIL PROTECTED] | | Lilienthal-Str. 7| Phone : +49-89-45026-108 | | 85579 Neubiberg | Fax : +49-89-45026-113 | ++-+ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs