From: Ian Jackson Date: Sat, 22 May 2010 18:26:06 +0000 (+0100) Subject: Rotate the logfile X-Git-Tag: userv/0.6.1~90 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv-utils.git;a=commitdiff_plain;h=c6106de89f45eeb5f684ccfb2627d6259b1f881b;ds=sidebyside Rotate the logfile --- diff --git a/.gitignore b/.gitignore index 59c56ee..3c1c4b2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ git-daemon/inetd.conf git-daemon/git-daemon git-daemon/git-service git-daemon/sedscript +git-daemon/logrotate diff --git a/git-daemon/Makefile b/git-daemon/Makefile index 1a18f66..ad8dd78 100644 --- a/git-daemon/Makefile +++ b/git-daemon/Makefile @@ -7,9 +7,16 @@ include ../settings.make -TARGETS= git-upload-pack inetd.conf git-daemon git-service +gituser= git +varloggit= $(varlog)/git -SUBSTVARS= libuserv etcuserv varlog +TARGETS= git-upload-pack inetd.conf git-daemon git-service logrotate + +SUBSTVARS= libuserv etcuserv varloggit gituser + +CONFIGS= $(services)/git-upload-pack \ + $(etcuserv)/git-urlmap \ + $(etcdir)/logrotate.d/userv-git-daemon all: $(TARGETS) @@ -26,14 +33,17 @@ sedscript: Makefile read-urlmap mv -f $@.new $@ install: all - mkdir -p $(libuserv) $(etcuserv) $(services) + mkdir -p $(libuserv) $(etcuserv) $(services) \ + $(etcdir)/logrotate.d + install -d -o $(gituser) -g adm $(varloggit) cp git-daemon git-service $(libuserv) cp git-upload-pack $(services)/git-upload-pack:new cp git-urlmap $(etcuserv)/git-urlmap:new - set -e; cd $(services); test -f git-upload-pack \ - || mv git-upload-pack:new git-upload-pack - set -e; cd $(etcuserv); test -f git-urlmap \ - || mv git-urlmap:new git-urlmap + cp logrotate $(etcdir)/logrotate.d/userv-git-daemon:new + set -e; for f in $(CONFIGS); do \ + if test -f $$f; then continue; fi; \ + mv $$f:new $$f; \ + done clean: rm -f $(TARGETS) diff --git a/git-daemon/git-upload-pack.in b/git-daemon/git-upload-pack.in index c66c61c..bb4e847 100644 --- a/git-daemon/git-upload-pack.in +++ b/git-daemon/git-upload-pack.in @@ -6,7 +6,7 @@ if ( grep service-user-shell /etc/shells & glob service git-upload-pack - & glob calling-user git + & glob calling-user @gituser@ ) reset errors-to-syslog daemon error diff --git a/git-daemon/inetd.conf.in b/git-daemon/inetd.conf.in index 11bf717..f316fcc 100644 --- a/git-daemon/inetd.conf.in +++ b/git-daemon/inetd.conf.in @@ -1,2 +1,2 @@ # Example inetd.conf line for the userv git daemon. -git stream tcp nowait git /usr/sbin/tcpd @libuserv@/git-daemon -L@varlog@/git/userv-git-daemon.log @etcuserv@/git-urlmap +git stream tcp nowait @gituser@ /usr/sbin/tcpd @libuserv@/git-daemon -L@varloggit@/userv-git-daemon.log @etcuserv@/git-urlmap diff --git a/git-daemon/logrotate.in b/git-daemon/logrotate.in new file mode 100644 index 0000000..06e0ef2 --- /dev/null +++ b/git-daemon/logrotate.in @@ -0,0 +1,6 @@ +@varloggit@/userv-git-daemon.log { + rotate 7 + daily + missingok + delaycompress +}