Server Automated Re-starter - beta
Features:
- Edit time.txt in the directory SARfiles to edit the time management settings.
- Faster and displays errors.
About:
This nifty piece of software can be used on servers to automatically restart and run your server within specified time periods.
Setting Up:
- Copy the following code into notepad.
Code:
::Copyright © MMVIII all rights reserved 2008
@echo off
Title Server Automated Restarter - Time Management
:SARfiles Creator
If exist SARfiles (
goto CalcTime
) else (
md SARfiles
echo 1800>SARfiles\time.txt
)
:CalcTime
If exist SARfiles\time.txt (
set /p time=<SARfiles\time.txt
) else (
goto Error 2
)
:start
::run.bat check and initialization
If exist run.bat (
start run.bat
) else (
goto Error 1
)
:loop
cls
IF %time% GTR 0 (
set /a time=%time% - 1
set /a min=%time%/60
echo Next Restart In %time% Seconds.
echo %time% Seconds is %min% Minutes.
title %min% Minutes
ping 127.0.0.1 -n 2 > NUL
goto loop
)
taskkill /f /im java.exe
echo Waiting 3 seconds for computer delay consideration...
ping 127.0.0.1 -n 2 > NUL
ping 127.0.0.1 -n 2 > NUL
ping 127.0.0.1 -n 2 > NUL
cls
goto CalcTime
:Error 1
cls
echo Error: Java starter could not be found.
echo Please rename your java starter to run.bat and then restart this program.
pause >nul
exit
:Error 2
cls
echo Error: time.txt could not be found.
echo Please create a file named time.txt and within it place the desired restart time.
pause >nul
exit
- Save the file as SAR.bat in the same directory as your run.bat
- Open your run.bat and if it contains "pause" delete that. (Without the "")
- Open your run.bat and type "exit" as your last line. (Without the "")
- Finally double click the file to run it.
- Go into the folder SARfiles and find time.txt, open it and replace the number with the time between restarts (in seconds). It is set to 30 minutes at the moment as 1800 seconds is 30 minutes.
Virus Scan:
Due to a slight worry in the .exe file i have posted the code instead. Sorry for any inconvenience. :tu: