Advertisement
Guest User

rotate_logs.bat

a guest
Mar 3rd, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 5.84 KB | None | 0 0
  1. set arma2srvpath=C:
  2. set srvname=cfgdayz
  3. set deloriglogs=1
  4.  
  5. IF "%1"=="" (
  6. set servername=%srvname%
  7. ) else (
  8. set servername=%1
  9. )
  10.  
  11. title DayZ %servername% Server Log Rotater
  12.  
  13. :: Set Debug Mode
  14. set debug=0
  15. :: Set Debug Timeout in seconds
  16. set dbsecs=10
  17.  
  18. :: Display Debug output
  19. if %debug% == 1 (
  20. echo Server Name = %servername%
  21. echo ArmaII Server Path = "%arma2srvpath%"
  22. timeout %dbsecs%
  23. )
  24.  
  25. :: Set Time and Date
  26. SET HOUR=%time:~0,2%
  27. SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%_0%time:~1,1%%time:~3,2%_%time:~6,2%
  28. SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%_%time:~6,2%
  29. ::Make Date Stamp
  30. if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)
  31. ECHO Todays Date and time (%date%)(%time%) / %dtStamp%
  32. if %debug% == 1 (
  33. timeout %dbsecs%
  34. )
  35.  
  36. echo (%date%) (%time%) Starting Log Rotation.
  37.  
  38. :: Make the Rotated Log Directories
  39. if exist "C:\DayzLogs" goto maketsdir
  40. mkdir "C:\DayzLogs"
  41. :maketsdir
  42. if exist "C:\DayzLogs\%dtStamp%" goto makebedir
  43. mkdir "C:\DayzLogs\%dtStamp%"
  44. :makebedir
  45. if exist "C:\DayzLogs\%dtStamp%\BattlEye" goto rotatelogs
  46. mkdir "C:\DayzLogs\%dtStamp%\BattlEye"
  47.  
  48. :rotatelogs
  49. :: Starting Log Rotation. If there are any other logs, just follow the format below, and make sure to NOT touch any of the variables.
  50. copy "%arma2srvpath%\%servername%\arma2oaserver.RPT" "C:\DayzLogs\%dtStamp%\arma2oaserver.RPT"
  51. copy "%arma2srvpath%\%servername%\arma2oaserver.mdmp" "C:\DayzLogs\%dtStamp%\arma2oaserver.mdmp"
  52. copy "%arma2srvpath%\%servername%\arma2oaserver.bidmp" "C:\DayzLogs\%dtStamp%\arma2oaserver.bidmp"
  53. copy "%arma2srvpath%\%servername%\server_log.txt" "C:\DayzLogs\%dtStamp%\server_log.txt"
  54. copy "%arma2srvpath%\%servername%\HiveExt.log" "C:\DayzLogs\%dtStamp%\HiveExt.log"
  55. copy "%arma2srvpath%\%servername%\BattlEye\attachto.log" "C:\DayzLogs\%dtStamp%\BattlEye\attachto.log"
  56. copy "%arma2srvpath%\%servername%\BattlEye\addbackpackcargo.log" "C:\DayzLogs\%dtStamp%\BattlEye\addbackpackcargo.log"
  57. copy "%arma2srvpath%\%servername%\BattlEye\addweaponcargo.log" "C:\DayzLogs\%dtStamp%\BattlEye\addweaponcargo.log"
  58. copy "%arma2srvpath%\%servername%\BattlEye\deletevehicle.log" "C:\DayzLogs\%dtStamp%\BattlEye\deletevehicle.log"
  59. copy "%arma2srvpath%\%servername%\BattlEye\remotecontrol.log" "C:\DayzLogs\%dtStamp%\BattlEye\remotecontrol.log"
  60. copy "%arma2srvpath%\%servername%\BattlEye\selectplayer.log" "C:\DayzLogs\%dtStamp%\BattlEye\selectplayer.log"
  61. copy "%arma2srvpath%\%servername%\BattlEye\setvariableval.log" "C:\DayzLogs\%dtStamp%\BattlEye\setvariableval.log"
  62. copy "%arma2srvpath%\%servername%\BattlEye\teamswitch.log" "C:\DayzLogs\%dtStamp%\BattlEye\teamswitch.log"
  63. copy "%arma2srvpath%\%servername%\BattlEye\waypointcondition.log" "C:\DayzLogs\%dtStamp%\BattlEye\waypointcondition.log"
  64. copy "%arma2srvpath%\%servername%\BattlEye\waypointstatements.log" "C:\DayzLogs\%dtStamp%\BattlEye\waypointstatements.log"
  65. copy "%arma2srvpath%\%servername%\BattlEye\scripts.log" "C:\DayzLogs\%dtStamp%\BattlEye\scripts.log"
  66. copy "%arma2srvpath%\%servername%\BattlEye\createvehicle.log" "C:\DayzLogs\%dtStamp%\BattlEye\createvehicle.log"
  67. copy "%arma2srvpath%\%servername%\BattlEye\mpeventhandler.log" "C:\DayzLogs\%dtStamp%\BattlEye\mpeventhandler.log"
  68. copy "%arma2srvpath%\%servername%\BattlEye\publicvariable.log" "C:\DayzLogs\%dtStamp%\BattlEye\publicvariable.log"
  69. copy "%arma2srvpath%\%servername%\BattlEye\publicvariableval.log" "C:\DayzLogs\%dtStamp%\BattlEye\publicvariableval.log"
  70. copy "%arma2srvpath%\%servername%\BattlEye\remoteexec.log" "C:\DayzLogs\%dtStamp%\BattlEye\remoteexec.log"
  71. copy "%arma2srvpath%\%servername%\BattlEye\setdamage.log" "C:\DayzLogs\%dtStamp%\BattlEye\setdamage.log"
  72. copy "%arma2srvpath%\%servername%\BattlEye\setpos.log" "C:\DayzLogs\%dtStamp%\BattlEye\setpos.log"
  73. copy "%arma2srvpath%\%servername%\BattlEye\setvariable.log" "C:\DayzLogs\%dtStamp%\BattlEye\setvariable.log"
  74. copy "%arma2srvpath%\%servername%\BattlEye\addmagazinecargo.log" "C:\DayzLogs\%dtStamp%\BattlEye\addmagazinecargo.log"
  75. echo (%date%) (%time%) Logs are backed up now...
  76. echo (%date%) (%time%) Removing original log files.
  77. del /Q /F "%arma2srvpath%\%servername%\arma2oaserver.RPT"
  78. del /Q /F "%arma2srvpath%\%servername%\arma2oaserver.mdmp"
  79. del /Q /F "%arma2srvpath%\%servername%\arma2oaserver.bidmp"
  80. del /Q /F "%arma2srvpath%\%servername%\server_console.log"
  81. del /Q /F "%arma2srvpath%\%servername%\runtime.log"
  82. del /Q /F "%arma2srvpath%\%servername%\HiveExt.log"
  83. del /Q /F "%arma2srvpath%\%servername%\server_log.txt"
  84. del /Q /F "%arma2srvpath%\%servername%\BattlEye\attachto.log"
  85. del /Q /F "%arma2srvpath%\%servername%\BattlEye\addbackpackcargo.log"
  86. del /Q /F "%arma2srvpath%\%servername%\BattlEye\addweaponcargo.log"
  87. del /Q /F "%arma2srvpath%\%servername%\BattlEye\deletevehicle.log"
  88. del /Q /F "%arma2srvpath%\%servername%\BattlEye\remotecontrol.log"
  89. del /Q /F "%arma2srvpath%\%servername%\BattlEye\selectplayer.log"
  90. del /Q /F "%arma2srvpath%\%servername%\BattlEye\setvariableval.log"
  91. del /Q /F "%arma2srvpath%\%servername%\BattlEye\teamswitch.log"
  92. del /Q /F "%arma2srvpath%\%servername%\BattlEye\waypointcondition.log"
  93. del /Q /F "%arma2srvpath%\%servername%\BattlEye\waypointstatements.log"
  94. del /Q /F "%arma2srvpath%\%servername%\BattlEye\scripts.log"
  95. del /Q /F "%arma2srvpath%\%servername%\BattlEye\createvehicle.log"
  96. del /Q /F "%arma2srvpath%\%servername%\BattlEye\mpeventhandler.log"
  97. del /Q /F "%arma2srvpath%\%servername%\BattlEye\publicvariable.log"
  98. del /Q /F "%arma2srvpath%\%servername%\BattlEye\publicvariableval.log"
  99. del /Q /F "%arma2srvpath%\%servername%\BattlEye\remoteexec.log"
  100. del /Q /F "%arma2srvpath%\%servername%\BattlEye\setdamage.log"
  101. del /Q /F "%arma2srvpath%\%servername%\BattlEye\setpos.log"
  102. del /Q /F "%arma2srvpath%\%servername%\BattlEye\setvariable.log"
  103. del /Q /F "%arma2srvpath%\%servername%\BattlEye\addmagazinecargo.log"
  104.  
  105. if %debug% == 1 (
  106. timeout %dbsecs%
  107. )
  108.  
  109. :: We are done here.
  110. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement