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

I need advice and a weigh in from the wise ones. I'm using perl Win32::ChangeNotify to create persistant perl service which should always start up when the server starts up. I've created special directories where specifically formatted files can be deposited, upon which my perl script will extract and transform the files for delivery to a warehouse staging database. How do I keep the perl scripts running 24/7 waiting for the files to be dropped off? I've tried using active states dev kit to convert the scripts to .exe programs and scheduling them as windows tasks and this has worked but it was very picky I'm not sure how I did it. Not working now. This is on a remote server and I Terminal in, start the task, the window opens and runs. When I log out, the program is closed. I want it to stay on. Maybe I'm doing this all wrong? I just want to be able to create perl scripts which are always running.... even when I log off. What is the best way?

Replies are listed 'Best First'.
Re: Suppressing Windows CMD Window
by NetWallah (Canon) on Jun 26, 2009 at 22:19 UTC
Re: Suppressing Windows CMD Window
by Marshall (Canon) on Jun 27, 2009 at 01:08 UTC
    I think you are "barking up the wrong tree" with ChangeNotify, but that does depend upon how performant this application needs to be. A "cron" job or windows scheduler job that run say every 15 seonds or whatver could be just fine? ChangeNotify type of signals, etc are more complex and may be needed, but don't do that unless necessay.

    You are doing the right thing for debugging. But, the "Scheduled Program" has to be from an account on the server machine. NOT your login account on that machine. You have to have an account that can do this whether you are logged in or not.

    Update:>
    Your title said "suppress the CMD Line Window", but the text didn't talk about that. With Windows, look at the "START" command for a .bat file. You can suppress the cmd line window with options. Here is one URL of many "Start Windows:
    http://www.robvanderwoude.com/ntstart.php

Re: Suppressing Windows CMD Window
by Bloodnok (Vicar) on Jun 27, 2009 at 14:27 UTC
    I see you're using AS PDK, so further to NetWallahs answer, the PDK contains (or contained) something called perlsvc which, AFAIK, creates a Windoze compatible service from a perl script - tho' I freely admit to never having utilised it.

    A user level that continues to overstate my experience :-))
Re: Suppressing Windows CMD Window
by jarthda (Acolyte) on Jul 01, 2009 at 19:37 UTC
    Thanks for the wisdom Monks! I'm going to tackle this problem today, hopefully finish it. I agree I'm barking up the wrong tree but if I switch the Scheduled Task over to a local account and it works I'm done. Like I said I've been able to do this before, but can't remember how. Seems to me I had to do something to the cmd executable itself? Or the .exe produced by the toolkit.