Browse Source

logrotate update

Danja Vasiliev 10 years ago
parent
commit
96df8d3799

+ 1 - 1
openwrt/common/etc/config/fstab

@@ -20,7 +20,7 @@ config 'mount'
 
 ## compatibility
 config 'mount'
-  option 'device'       '/dev/sda'
+  option 'label'       'SUPERGLUE'
   option 'target'       '/mnt/sg'
   option 'enabled'      '1' 
   option 'enabled_fsck' '0' 

+ 0 - 2
openwrt/common/etc/config/network

@@ -17,7 +17,5 @@ config interface 'lan'
 	option ip6assign '60'
 
 #config interface 'wan'
-## strangely enough 'wlan0-1' goes to 'lan' bridge
-## and 'wlan0' becomes 'wan' interface. works thou!
 #  option ifname 'wlan0'
 #  option proto 'dhcp'

+ 1 - 5
openwrt/common/etc/crontabs/root

@@ -1,5 +1 @@
-1 6 * * *	  /sbin/logrotate /www/log/access.log \
-                            /www/log/error.log \
-                            /www/log/post.log \
-                            /www/log/admin.log; \
-                            /etc/init.d/lighttpd restart
+1 6 * * *	  /sbin/logrotate /www/log/*.log; /etc/init.d/lighttpd reload

BIN
openwrt/common/etc/lighttpd/.lighttpd.conf.swp


+ 4 - 0
openwrt/common/etc/logrotate.conf

@@ -0,0 +1,4 @@
+## config file for /sbin/logrotate
+## this is NOT compatible with standard GNU logrotate 
+
+ROTATE=120

+ 15 - 11
openwrt/common/sbin/logrotate

@@ -6,25 +6,29 @@
 ## Takes filepath(s) as argument:
 ## logrotate /www/access.log [/www/error.log] [/www/admin/admin.log]
 
-## backlogs to keep
-_ROTATE=7
-_DATE=$(date +%d.%m.%y-%H:%M:%S)
-_LOGS=( $* )
+## default settings, redefine in config file mentioned below 
+ROTATE=30  ## backlogs to keep
+DATE=$(date +%d.%m.%y-%H:%M:%S)
+LOGS=( $* )
+
+## source config
+CONF='/etc/logrotate.conf'
+[[ -e $CONF ]] && . $CONF
 
 function err {
   printf %s": "%s"\n" "$(basename $0)" "$1"; exit 1
 }
 
-[[ -z $_LOGS ]] && err 'missing input file'
-[[ ! -e $_LOGS ]] && err 'input file not readable'
+[[ -z $LOGS ]] && err 'missing input file'
+[[ ! -e $LOGS ]] && err 'input file not readable'
 
-for _FILE in ${_LOGS[@]}; do
+for FILE in ${LOGS[@]}; do
   ## get number of backlogs and purge unwanted
-  _N=( $(ls -1 -r $_FILE*.gz &>/dev/null || echo '') ) 
-  [[ ${#_N[@]} -gt $((_ROTATE-1)) ]] && rm -f ${_N[@]:$((_ROTATE-1)) }
+  N=( $(ls -1 -r $FILE*.gz &>/dev/null || echo '') ) 
+  [[ ${#N[@]} -gt $((ROTATE-1)) ]] && rm -f ${N[@]:$((ROTATE-1)) }
   ## compress and move
-  gzip -f $_FILE || err 'failed to gzip file'
-  mv $_FILE.gz "$_FILE"_"$_DATE".gz || err 'failed to rename archive'
+  gzip -f $FILE || err 'failed to gzip file'
+  mv $FILE.gz "$FILE""$DATE".gz || err 'failed to rename archive'
 done
 
 exit 0

+ 0 - 28
openwrt/common/www/htdocs/default.html

@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-		<meta name="generator" content="Superglue" data-superglue-version="1.0" data-superglue-settings="">
-		<title>Superglue test</title>
-		<style type="text/css" data-superglue="default-css">
-			body { margin: 0px; padding: 0px; }
-			#sg-page { position: relative; top: 0px; }
-			#sg-page.sg-page-centered { margin: 0px auto; }
-			.sg-element { position: absolute; overflow: hidden; }
-		</style>
-		<link rel="stylesheet" href="/resources/css/SuperGlue.css" data-superglue="text-css">
-	</head>
-	<body style="background-color: rgb(153, 151, 161); background-repeat: repeat;">
-		<div id="sg-page" class="sg-page-centered" style="width: 1156px;" data-superglue-grid="off/7px">
-			<div class="sg-element" data-superglue-type="ImageElement" style="left: 193px; top: 93px; width: 105px; height: 225px;">
-	<div style="width: 100%; height: 100%; background-image: url(/resources/img/superglueLogo.png); background-repeat: repeat-y;"></div>
-			</div>
-			<div class="sg-element" data-superglue-type="TextElement" style="left: 313px; top: 193px; width: 270px; height: 55px;">
-<p style="font-size: 40px; font-family: Sans;"><span style="font-family: Montserrat;"><b><span style="font-size: 40px;">SUPERGLUE</span></b></span></p>
-			</div>
-			<div class="sg-element" data-superglue-type="TextElement" style="left: 315px; top: 266px; width: 456px; height: 80px;">
-<span style="font-size: 14px; font-family: Montserrat;"><b></b></span><span style="font-size: 14px; font-family: Montserrat;"><b><span style="color: rgb(214, 44, 44); font-size: 14px;">NO STORAGE IS AVAILABLE !!</span></b></span><div><font color="#d62c2c" face="Montserrat"><span style="font-size: 14px;"><b><br></b></span></font><div><b style="font-family: Montserrat; color: rgb(214, 44, 44);"><span style="font-size: 14px;">PLEASE MAKE SURE YOUR USB DRIVE IS CONNECTED</span></b><br></div></div>
-			</div>
-		</div>
-	</body>
-</html>

+ 1 - 0
openwrt/common/www/htdocs/default.html

@@ -0,0 +1 @@
+../lib/resources/failsafe.html

+ 4 - 4
openwrt/make_fw.sh

@@ -18,15 +18,15 @@ _BUILDS="$_PWD/../../../sg-builds"
 [[ -e $_BUILDS ]] || (echo 'Builds directory is missing'; exit 1;)
 
 ## dirs with platform specific files
-_TARGETS='DIR505A1 TLWR710 WRT160NL'
-#_TARGETS='DIR505A1'
+#_TARGETS='DIR505A1 TLWR710 WRT160NL'
+_TARGETS='TLWR710'
 
 ## dir with common files
 _COMMON='common'
 
 _MAJOR='0.1'  ## bump that on major changes
 #_SUFFIX='git'  ## could be 'beta', 'rc', etc
-_SUFFIX='testing'  ## could be 'beta', 'rc', etc
+_SUFFIX='k0a1a'  ## could be 'beta', 'rc', etc
 
 ## read build serial, incremented on every successful build
 if [[ -e sg_$_MAJOR.revision ]]; then
@@ -58,7 +58,7 @@ for _TARGET in $_TARGETS; do
   echo $_VERSION > $_TARGET.tmp/etc/superglue_version
   cd $_IMAGEBUILDER && make clean
 
-  make image PROFILE=$_TARGET PACKAGES="bash gawk sudo procps-ps haserl lighttpd lighttpd-mod-access lighttpd-mod-cgi lighttpd-mod-compress lighttpd-mod-accesslog lighttpd-mod-rewrite lighttpd-mod-auth lighttpd-mod-alias lighttpd-mod-setenv blkid kmod-fs-ext4 kmod-fs-vfat kmod-fs-btrfs btrfs-progs block-mount mini-sendmail kmod-usb-storage kmod-scsi-generic mount-utils kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-nls-base coreutils-stat mini-httpd-htpasswd" FILES=$_PWD/$_TARGET.tmp BIN_DIR=$_BUILDS/$_VERSION/$_TARGET/openwrt && 
+  make image PROFILE=$_TARGET PACKAGES="bash gawk sudo procps-ps haserl lighttpd lighttpd-mod-access lighttpd-mod-cgi lighttpd-mod-compress lighttpd-mod-accesslog lighttpd-mod-rewrite lighttpd-mod-auth lighttpd-mod-alias lighttpd-mod-setenv blkid kmod-fs-ext4 kmod-fs-vfat kmod-fs-btrfs btrfs-progs block-mount mini-sendmail kmod-usb-storage kmod-scsi-generic mount-utils kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-nls-base coreutils-stat mini-httpd-htpasswd wireless-tools" FILES=$_PWD/$_TARGET.tmp BIN_DIR=$_BUILDS/$_VERSION/$_TARGET/openwrt && 
 
   ln -s $_BUILDS/$_VERSION/$_TARGET/openwrt/openwrt-*-factory.bin $_BUILDS/$_VERSION/$_TARGET/superglue-firmware-$_VERSION-$(echo $_TARGET | tr [:upper:] [:lower:])-factory.bin
   ln -s $_BUILDS/$_VERSION/$_TARGET/openwrt/openwrt-*-sysupgrade.bin $_BUILDS/$_VERSION/$_TARGET/superglue-firmware-$_VERSION-$(echo $_TARGET | tr [:upper:] [:lower:])-sysupgrade.bin

+ 1 - 1
openwrt/sg_0.1.revision

@@ -1 +1 @@
-8
+19