I have installed a Windows Service through Common Apache Daemon Service . My Installation batch file's code is as
@echo off
setlocal
rem The service names (make sure they does not clash with an existing service)
rem set SERVICE_JVM=MyService
set SERVICE_JAVA=MyService
rem my location
set MYPATH=C:\MyService\src\classes
rem location of Prunsrv
set PATH_PRUNSRV=C:\MyService\src\bin
set PR_LOGPATH=C:\MyService\logs
rem location of jarfile
set PATH_JAR=%MYPATH%
rem Allow prunsrv to be overridden
if "%PRUNSRV%" == "" set PRUNSRV=%PATH_PRUNSRV%\MyService.exe
rem Install the 2 services
echo Installing %SERVICE_JVM%
%PRUNSRV% //DS//%SERVICE_JVM%
%PRUNSRV% //IS//%SERVICE_JVM%
echo Setting the parameters for %SERVICE_JAVA%
%PRUNSRV% //US//%SERVICE_JVM% --Startup=auto --Jvm=auto --StdOutput auto --StdError auto ^
--Classpath=%PATH_JAR%\MyService.jar ^
--StartMode=jvm --StartClass=Webmuch.MyService --StartMethod=main --StartParams=start ^
--StopMode=jvm --StopClass=Webmuch.MyService --StopMethod=main --StopParams=stop
echo Installation of %SERVICE_JAVA% is complete
echo Installing %SERVICE_JAVA%
%PRUNSRV% //DS//%SERVICE_JAVA%
%PRUNSRV% //IS//%SERVICE_JAVA%
echo Setting the parameters for %SERVICE_JAVA%
%PRUNSRV% //US//%SERVICE_JAVA% --Startup=auto --Jvm=auto --StdOutput auto --StdError auto ^
--Classpath=%PATH_JAR%\MyService.jar ^
--StartMode=jvm --StartClass=Webmuch.MyService --StartMethod=main --StartParams=start ^
--StopMode=jvm --StopClass=Webmuch.MyService --StopMethod=main --StopParams=stop
%PRUNSRV% //TS//%SERVICE_JAVA%
echo Installation of %SERVICE_JAVA% is complete
echo Finished
When I run this batch file in shell command as
InstallService.bat
my service is installed and running and also when ever i run my service as
MyService.exe //TS//MyService
It is working fine .
But My requirement is to run this service on interval of every 2 hours automatically when personal system machine starts .
I do't know from where i can make configuration regarding this ?
If Any have idea please help me .
Thanks a lot in advance .
For 2 hours, you can:
:loop
rem call your service
timeout 7200
goto loop