Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

how do I create service on Win32?

by xiaoyafeng (Deacon)
on May 14, 2007 at 01:54 UTC ( [id://615209]=perlquestion: print w/replies, xml ) Need Help??

xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

esteemed monks,

I have a auto-backup script. I have tried to 'extend' it a window service, so it could run automatically when system start and reload if it stop somehow.

any suggestions?

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: how do I create service on Win32?
by NetWallah (Canon) on May 14, 2007 at 04:38 UTC
    One of the simplest ways to make a Win32 service from a command line program is to use instsrv and srvany from the Windows Server 2003 Resource Kit Tools.

    The documentation on this is not very clear, so here is the big picture:
    srvany is the actual "service" - it runs the code specified in the registry.
    instsrv is used to configure registry entries to be used by srvany. This can be done manually as well, so Instsrv is not necessarily "required", but it does help. This is run ONE TIME, to create the service.

    Note - this process merely converts a command line program into a service. If you want YOUR CODE to respond to service start and other control commands, you will need to use something like Win32::Daemon::Simple.

    Update 1: If all you are doing is a "backup", the Windows task scheduler may be a more appropriate solution.

    Update 2: Fixed Typo (missing colon in module name) - Thanks Jenda.

         "An undefined problem has an infinite number of solutions." - Robert A. Humphrey         "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman

Re: how do I create service on Win32?
by jdporter (Paladin) on May 14, 2007 at 04:46 UTC
Re: how do I create service on Win32?
by marto (Cardinal) on May 14, 2007 at 08:29 UTC
      Actually, I always use Super Search before i post. But my key word is daemon.

      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
        Yet at no point in your post do you mention 'daemon', perhaps using Super Search with the term 'Windows service' would have been a better idea.

        Martin
Re: how do I create service on Win32?
by Anonymous Monk on May 14, 2007 at 04:41 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://615209]
Approved by BrowserUk
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found