shithub: rc

Download patch

ref: b46537efa8eb679940ae74ca90f033e703ba62af
parent: 0165e83598f06c10aabf676e5798d84f9a464510
author: Stephen Jones <smj@9p.sdf.org>
date: Wed Oct 20 14:12:03 EDT 2021

moved logrotate into garden

--- a/README.md
+++ b/README.md
@@ -26,20 +26,6 @@
     '-(_/,__.--^--"  *      * 
                    *     *        *
 
-## logrotate
-
-A multi-generational log rotator.  Runs as the hostowner
-from cron.  Take the defaults or edit these 4 varables in
-the script:
-
-logdir		Where your log files live if not /sys/log
-logfiles 	What files you want rotated
-generations	How many generations to you want to keep
-maxsize		How big can the logfile get before its rotated
-
-Run from cron at midnight every sunday
-0 0 * * 0 $sysname pathto/logrotate
-
 ## surl
 
 A URL shortener.  Assumes you're running a web server and
--- a/logrotate
+++ /dev/null
@@ -1,43 +1,0 @@
-#!/bin/rc
-
-#
-# edit these 4 variables to your preference
-# 0	0 * * 0 $sysname /usr/glenda/bin/logrotate
-#
-logdir=/sys/log
-logfiles=(auth cpu cron dns gemini httpd/log listen mail runq smtp smtp.fail smtpd)
-generations=14
-maxsize=1024000
-
-if(! test -d $logdir){
-	echo $logdir does not exist
-	exit
-}
-
-fn Rotate{
-	gen=$generations
-	while(test $gen -ge '0'){
-		pgen=`{echo $gen - 1|bc}
-		if(test -f $logdir/$1.$pgen.gz){
-			cp $logdir/$1.$pgen.gz $logdir/$1.$gen.gz
-			chmod 0700 $logdir/$1.$gen.gz
-		}
-		gen=$pgen
-
-	}
-	gzip -c $logdir/$1 > $logdir/$1.0.gz
-	chmod -a $logdir/$i
-	>$logdir/$i
-	chmod +a $logdir/$i
-}
-
-for(i in $logfiles){
-	if(test -f $logdir/$i){
-		size=`{du -n $logdir/$i|awk '{print $1}'}
-		if(test $size -gt $maxsize){
-			Rotate $i
-		}
-	}
-}
-
-