October 28, 2014 03:06PM
rotatelogs.cmd

@echo off
::Parse the time variable into timeStamp
FOR /F "tokens=1-4 delims=/:., " %%J IN ("%time%") DO SET timeStamp=%%J%%K%%L
::Parse the date variable into dateStamp, YYYYMMDD
FOR /F "tokens=2-4 delims=/:.- " %%J IN ("%date%") DO SET dateStamp=%%L%%K%%J
set datename=%dateStamp%
::Parse the name again and get rid of the spaces
FOR /F "tokens=1-4" %%J IN ("%datename%") DO SET datename=%%J%%K%%L
IF "%datename%"=="" set datename=EMPTY

cd /d x:\logs
FOR %%G IN (*.log) DO ren "%%G" "%datename%_%%G"

choice /t:y,5
cd /d c:\nginx
runas /savecred /env /user:nginxserviceuser "nginx -s reopen"
choice /t:y,5

cd /d x:\logs
move /y %datename%_*.* x:\archives\logdata

---
nginx for Windows http://nginx-win.ecsds.eu/
Subject Author Posted

Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 11:40AM

Re: Rotating Access Logs with $date_local

Maxim Dounin October 28, 2014 11:56AM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 12:50PM

Re: Rotating Access Logs with $date_local

Francis Daly October 28, 2014 01:14PM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 01:20PM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 02:08PM

Re: Rotating Access Logs with $date_local

itpp2012 October 28, 2014 03:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 191
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready