ref: 6a179c0db1f31cbab6cff01639f9e7c73276ca92
parent: a300ce7cfdab8d0ec1a39c48c0a5d55575cfbdbe
author: Stephen Jones <[email protected]>
date: Sun Oct 17 14:02:17 EDT 2021
Added logrotate, updated surl and some docu
--- /dev/null
+++ b/logrotate
@@ -1,0 +1,46 @@
+#!/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 listen mail runq smtp smtp.fail smtpd)
+generations=14
+maxsize=102400
+
+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
+}
+
+for(i in $logfiles){
+ if(test -f $logdir/$i){
+ size=`{du -n $logdir/$i|awk '{print $1}'}
+ if(test $size -gt $maxsize){
+ Rotate $i
+ #
+ # I is dum - logfile are open/append at boot so I caveman smash. help me.
+ #
+ rm -f $logdir/$i
+ touch $logdir/$i
+ chmod 0662 $logdir/$i
+ }
+ }
+}
+
+
--- a/surl
+++ b/surl
@@ -18,7 +18,7 @@
last=0
}
last=`{echo $last|tr a-z A-Z}
- next=`{echo 'ibase=16;obase=16; ' $last+1 | bc|awk '{print $1}'}
+ next=`{echo 'obase=16; ' $last+1 | bc}
mkdir $surl/$next
echo '<html><meta http-equiv=refresh content="0; url='$url'"></html>' > $surl/$next/index.html
echo $site/l/$next