Use nssm instead of sc
This commit is contained in:
1 parent
59ba823865
commit
d05ba5cc55
5 files changed
+56
-11
No files matched your search
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"update_url": "https://triztech.pro/cpanelwebcall/TOKEN",
|
||||
"check_interval_seconds": 30,
|
||||
"ip_check_url": "https://api.ipify.org"
|
||||
}
|
||||
@@ -1,23 +1,41 @@
|
||||
@echo off
|
||||
REM ===============================
|
||||
REM DDNS Updater Install using NSSM
|
||||
REM ===============================
|
||||
|
||||
REM Get the folder where this bat is located
|
||||
SET SCRIPT_DIR=%~dp0
|
||||
|
||||
REM Define the service exe path (same folder as bat)
|
||||
REM Define program and NSSM paths
|
||||
SET EXE_NAME=DDNSUpdater.exe
|
||||
SET EXE_PATH=%SCRIPT_DIR%%EXE_NAME%
|
||||
SET NSSM_PATH=%SCRIPT_DIR%nssm.exe
|
||||
|
||||
REM Check if the exe exists
|
||||
REM Check if files exist
|
||||
IF NOT EXIST "%EXE_PATH%" (
|
||||
echo ERROR: %EXE_NAME% not found in the same folder as this script.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Create the service (auto-start)
|
||||
sc create DDNSUpdaterService binPath= "%EXE_PATH%" start= auto
|
||||
IF NOT EXIST "%NSSM_PATH%" (
|
||||
echo ERROR: nssm.exe not found in the same folder as this script.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Remove existing service if present
|
||||
"%NSSM_PATH%" remove DDNSUpdaterService confirm
|
||||
|
||||
REM Install service
|
||||
"%NSSM_PATH%" install DDNSUpdaterService "%EXE_PATH%"
|
||||
|
||||
REM Optional: auto-start at boot
|
||||
"%NSSM_PATH%" set DDNSUpdaterService Start SERVICE_AUTO_START
|
||||
|
||||
REM Start the service
|
||||
sc start DDNSUpdaterService
|
||||
"%NSSM_PATH%" start DDNSUpdaterService
|
||||
|
||||
echo Service DDNSUpdaterService installed and started.
|
||||
echo.
|
||||
echo DDNSUpdaterService installed and started successfully!
|
||||
pause
|
||||
Binary file not shown.
@@ -1,5 +1,21 @@
|
||||
@echo off
|
||||
sc stop DDNSUpdaterService
|
||||
sc delete DDNSUpdaterService
|
||||
echo Service DDNSUpdaterService stopped and deleted.
|
||||
REM ===============================
|
||||
REM DDNS Updater Uninstall using NSSM
|
||||
REM ===============================
|
||||
|
||||
SET SCRIPT_DIR=%~dp0
|
||||
SET NSSM_PATH=%SCRIPT_DIR%nssm.exe
|
||||
|
||||
IF NOT EXIST "%NSSM_PATH%" (
|
||||
echo ERROR: nssm.exe not found in the same folder as this script.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Stop and remove the service
|
||||
"%NSSM_PATH%" stop DDNSUpdaterService
|
||||
"%NSSM_PATH%" remove DDNSUpdaterService confirm
|
||||
|
||||
echo.
|
||||
echo DDNSUpdaterService uninstalled successfully!
|
||||
pause
|
||||
Reference in new issue
Block a user