Here is the batch script that I use to restart my server:
save as "restart.bat":
Code:
@echo off
cls
rem OTServersave (OTSS) - Batch script using OTAdmin
rem ------------------------------------------------
rem Developer: Felipe Correa (Nightmare) (based on GriZzm0 shell script)
rem First Release: February 6, 2008
rem Current Release: February 6, 2008
rem Version: 0.1b
rem
rem OTAdmin (wiki): http://otserv.org/index.php?title=OTAdmin
rem OTAdmin (sources/binaries): https://sourceforge.net/project/showfiles.php?group_id=32523&package_id=202862&release_id=567041
rem
rem Programs used: otadmin
rem ------------------------------------------------
rem ################# START CONFIG #################
rem ## otserv dir without the final "\" ##
set OTSERV_DIR="C:\otserv"
rem ## otserv executable name ##
set OTSERV_EXE="otserv.exe"
rem ## path to the otadmin executable ##
set OTADMIN_PATH="C:\otadmin\otadmin.exe"
rem ## otadmin settings ##
set OTADMIN_IP="localhost"
set OTADMIN_PORT="7171"
set OTADMIN_PASSWORD="test"
rem ## otadmin commands ##
set OTADMIN_COMMANDS="server %OTADMIN_IP% %OTADMIN_PORT%" "connect %OTADMIN_PASSWORD%" "broadcast The server is going down for a serversave in 15 minutes." "sleep 300000" "broadcast The server is going down for a serversave in 10 minutes." "sleep 300000" "broadcast The server is going down for a serversave in 5 minutes." "sleep 120000" "broadcast The server is going down for a serversave in 3 minutes. Please logout." "sleep 120000" "broadcast The server is going down for a serversave in one minute. Please logout." "sleep 60000" "closeserver" "broadcast Server closed. Ten seconds until server shutdown." "sleep 10000" "shutdown" "sleep 10000" "disconnect"
rem ################## END CONFIG ##################
echo :: Checking config...
if not exist %OTSERV_DIR%\%OTSERV_EXE% (
goto WORNG_OTSERV_PATH
)
if not exist %OTADMIN_PATH% (
goto WORNG_OTADMIN_PATH
)
echo :: All config are ok!
echo :: Starting OTAdmin...
%OTADMIN_PATH% %OTADMIN_COMMANDS%
echo :: OTADMIN: Commands executed successfully!
echo :: Sleeping 30 seconds...
ping 0.0.0.0 -n 30 -w 1000 > nul
echo :: Starting server...
cd %OTSERV_DIR%
%OTSERV_EXE%
exit
:WORNG_OTSERV_PATH
echo :: Wrong OTServ dir and/or execuatble!
pause
exit
:WORNG_OTADMIN_PATH
echo :: Wrong OTAdmin path!
pause
exit
Just edit the settings (OTSERV_DIR, OTSERV_EXE, OTADMIN_PATH, OTADMIN_IP, OTADMIN_PORT and OTADMIN_PASSWORD) and set a "Scheduled Task" for it.
To schedule a task on windows go to Start > All programs > Accessories > System Tools > Scheduled Tasks.