I can't help you with HTTP::Proxy, but when I run perl as a service under windows, I simply use a sub-routine named DaemonLoop like this over-simplified example...
#################################################################
# Function: DaemonLoop #
# Description: Run our various tasks #
#################################################################
sub DaemonLoop {
while(1) {
# <Your code here...>
sleep $ENV{SLEEP_TIME};
}
return 0;
}
The start/stop/restart can be handled manually with the Services Administrative Tool, or you can write a simple .cmd script and issue start/stop commands...
echo Stopping ArchMaint >> %LOG_FILE%
NET STOP ArchMaint >> %LOG_FILE% 2>&1
set SAVE_ERRORLEVEL=%ERRORLEVEL%
echo Return code = %SAVE_ERRORLEVEL% >> %LOG_FILE%
if not "%SAVE_ERRORLEVEL%"=="0" call :SEND_EMAIL ArchMaint not run
+ning
if exist %NTRESKIT%\sleep.exe %NTRESKIT%\sleep 10
echo Starting ArchMaint >> %LOG_FILE%
net START ArchMaint >> %LOG_FILE% 2>&1
set SAVE_ERRORLEVEL=%ERRORLEVEL%
echo Return code = %SAVE_ERRORLEVEL% >> %LOG_FILE%
if not "%SAVE_ERRORLEVEL%"=="0" call :SEND_EMAIL ArchMaint start f
+ailed
echo Finished restarting ArchMaint >> %LOG_FILE%
|