- Who starts the application and when?
- Does the app continue to run if the user logs off?
- What about when another user logs on?
- Does the user need (or would it be useful for them to), interact with the app on occasion?
For entirely unattended, background operations, start at boot and continue regardless of user, Win32::Daemon is probably the way to go though there is some learning curve involved. You have to understand the modes of operation for windows services and how to control and interact with them. Also, Jan Krynicky's Win32::Daemon::Simple is easier to get started with.
If the user needs to interact with the app, either by querying it or configuring it, or if the app should only run for a specific user, then Win32::SysTray may be a more appropriate way to go.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
I'm looking to run a home monitoring workstation attached to the internet.
1. The home user would start the application or it could start automatically on boot.
2) or it could run on a users personal PC and with that in mind it would need not be affected by the users activities. It would have control devices attached to it.
3) and when others log on it should keep running. It not a user function but a 'house' function.
4. I'd like to see the application have a window, or terminal, or some icon that could be minimized if needed. So you could see status or enter a display command.
I do like the idea of having it shutdown, maybe everyday at midnight and have a cron/scheduler job restart it at 12.05.
| [reply] |
| [reply] |
You could use the wperl executable that comes with ActivePerl instead of perl. It forgoes using a console.
Or you could write your script as a service so you don't even need to be logged in for it to run. See Win32::Daemon
| [reply] [d/l] [select] |
BrowserUK brings up some good points. The nature of your script's operation will dictate the kind of solution you'll want to use.
I'll share one kind of solution I've used in a Unix environment. Something that needs to operate once a minute is just a little too frequent to use cron for. However, that doesn't mean that you couldn't use it to check on your process every so often just to make sure it is still running and restart it if necessary. I've seen long-running scripts which either purposely terminate or re-start themselves every so often to "clear out the cruft" that can build up over a long running session. Sometimes it's due to unavoidable memory or resource leaks, but it is also just defensive programming. I've even heard of companies which rebooted their machines every day (but that was a while ago, like back in the perl4 days.)
| [reply] [d/l] |
Another possibility would be to use Cygwin cron. Just using it for cron would be overkill, but I love Cygwin. It makes Windows almost tolerable. | [reply] |