Skip to content

Commit

Permalink
Add disable functionality to child.cmd script
Browse files Browse the repository at this point in the history
Implemented a new command to handle the 'disable' action, which creates a disable file and logs the current date and time. Updated the reset functionality to also delete the disable file if it exists, enhancing the script's operational control. This change improves the script's robustness by allowing for a clean shutdown process.
  • Loading branch information
xiagw committed Jan 3, 2025
1 parent bd7bb56 commit 1ff8e33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/utils/child.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ echo.%1| findstr /i "^reset$ ^r$" >nul && goto :RESET
echo.%1| findstr /i "^upgrade$ ^u$" >nul && goto :UPGRADE
echo.%1| findstr /i "^install$ ^i$" >nul && goto :INSTALL_TASK
echo.%1| findstr /i "^server$ ^s$" >nul && goto :START_SERVER
echo.%1| findstr /i "^disable$ ^x$" >nul && goto :DISABLE

if exist "%DISABLE_FILE%" ( exit /b 0 )

Expand Down Expand Up @@ -97,9 +98,14 @@ if !##play_elapsed! GEQ %PLAY_MINUTES% (
goto :END

:: 以下是函数
:DISABLE
echo %DATE:~0,10% %TIME% > "%DISABLE_FILE%"
call :LOG "已禁用定时关机功能"
exit /b 0

:RESET
shutdown /a
del /Q /F "%PLAY_FILE%" "%REST_FILE%"
del /Q /F "%PLAY_FILE%" "%REST_FILE%" "%DISABLE_FILE%"
goto :END

:INSTALL_TASK
Expand Down

0 comments on commit 1ff8e33

Please sign in to comment.