SA-MP Server Log Rotation
#29

I made an edit, with this improvement, you dont need to specify the path, just remember to put it in your server folder

Code:
@echo off

Set ServerDirectory=%CD%
set ServerName="samp-server.exe"

for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set XDate=%%a-%%b-%%c

if not exist %ServerDirectory%\log mkdir %ServerDirectory%\log

echo Daily log rotator for SA-MP Servers by KingJ
echo Will rename the current log file to today's date (%DATE%)
echo and place it in the log folder.
echo.
echo Path to use:
echo %CD%
echo.
echo Ensure the server is not running.
echo.
echo This makes the server logs easier to manage
echo.
echo Stopping server...
taskkill /f /im "%ServerName%"
echo Renaming log file to server_log_%XDate%.txt
rename %ServerDirectory%\server_log.txt server_log_%XDate%.txt
echo Moving log to log folder...
move %ServerDirectory%\server_log_%XDate%.txt %ServerDirectory%\log
echo Starting Server...
start %ServerDirectory%\%ServerName%
echo.
echo Log rotation complete
Reply


Messages In This Thread
SA-MP Server Log Rotation - by KingJ - 16.09.2008, 18:50
Re: SA-MP Server Log Rotation - by pspleo - 16.09.2008, 18:55
Re: SA-MP Server Log Rotation - by kaisersouse - 16.09.2008, 18:56
Re: SA-MP Server Log Rotation - by KingJ - 16.09.2008, 18:57
Re: SA-MP Server Log Rotation - by ғαιιοцт - 16.09.2008, 18:57
Re: SA-MP Server Log Rotation - by kaisersouse - 16.09.2008, 19:02
Re: SA-MP Server Log Rotation - by KingJ - 16.09.2008, 19:05
Re: SA-MP Server Log Rotation - by ғαιιοцт - 16.09.2008, 19:16
Re: SA-MP Server Log Rotation - by KingJ - 16.09.2008, 19:21
Re: SA-MP Server Log Rotation - by ғαιιοцт - 16.09.2008, 19:22
Re: SA-MP Server Log Rotation - by KingJ - 16.09.2008, 21:11
Re: SA-MP Server Log Rotation - by KingJ - 16.09.2008, 21:41
Re: SA-MP Server Log Rotation - by Wash - 17.09.2008, 10:33
Re: SA-MP Server Log Rotation - by [M]deLux - 17.09.2008, 12:39
Re: SA-MP Server Log Rotation - by KingJ - 17.09.2008, 12:54
Re: SA-MP Server Log Rotation - by Wash - 17.09.2008, 13:50
Re: SA-MP Server Log Rotation - by KingJ - 17.09.2008, 18:10
Re: SA-MP Server Log Rotation - by mamorunl - 18.09.2008, 10:18
Re: SA-MP Server Log Rotation - by Wash - 18.09.2008, 14:01
Re: SA-MP Server Log Rotation - by chrisb345 - 18.09.2008, 19:23
Re: SA-MP Server Log Rotation - by Acoole - 18.09.2008, 20:44
Re: SA-MP Server Log Rotation - by -Sneaky- - 02.01.2009, 09:28
Re: SA-MP Server Log Rotation - by LethaL - 02.01.2009, 10:31
Re: SA-MP Server Log Rotation - by -Sneaky- - 02.01.2009, 10:37
Re: SA-MP Server Log Rotation - by kingdutch - 25.03.2009, 07:02
SA MP Server Log Rotation - by CipHoony - 22.07.2009, 10:10
Re: SA-MP Server Log Rotation - by Westie - 02.08.2009, 10:47
Re: SA-MP Server Log Rotation - by Machinehank34 - 11.08.2009, 16:06
Re: SA-MP Server Log Rotation - by Patrik356b - 25.08.2009, 21:03
Re: SA-MP Server Log Rotation - by shady91 - 08.10.2009, 03:53
Re: SA-MP Server Log Rotation - by DeltaAirlines12 - 21.10.2009, 22:07
SA MP Server Log Rotation - by brubsifiary - 28.12.2009, 02:03
Re: SA-MP Server Log Rotation - by Domenko - 19.02.2010, 15:53
Re: SA-MP Server Log Rotation - by Westie - 20.02.2010, 10:54
Re: SA-MP Server Log Rotation - by Westie - 10.03.2010, 01:39
Re: SA-MP Server Log Rotation - by viKKmaN - 10.03.2010, 18:34
Re: SA-MP Server Log Rotation - by Micko9 - 22.03.2010, 13:22
Re: SA-MP Server Log Rotation - by JernejL - 23.03.2011, 10:01
Re: SA-MP Server Log Rotation - by rapidhost - 04.12.2011, 12:33
Re : SA-MP Server Log Rotation - by ombre - 16.10.2012, 14:37

Forum Jump:


Users browsing this thread: 5 Guest(s)