From 9967b8231a083c630eea042ce93c2b003ee892c1 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 11 May 2023 15:24:15 +1000 Subject: Clean up messes and old results. --- update_apt-panopticon | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'update_apt-panopticon') diff --git a/update_apt-panopticon b/update_apt-panopticon index 180f090..ef4c740 100755 --- a/update_apt-panopticon +++ b/update_apt-panopticon @@ -1,11 +1,14 @@ #!/bin/bash -cd /var/www/html/apt-panopticon/apt-panopticon_cgp +PANOPATH="/var/www/html/apt-panopticon" +#KEEPDAYS=$((2 * 30)) + +cd ${PANOPATH}/apt-panopticon_cgp if [ -d .git ] ; then git pull > /dev/null chown -R www-data:www-data * fi -cd /var/www/html/apt-panopticon/apt-panopticon +cd ${PANOPATH}/apt-panopticon if [ -d .git ] ; then git pull > /dev/null chown -R www-data:www-data * @@ -28,6 +31,14 @@ if [ -f apt-panopticon.lock ] ; then rm apt-panopticon.lock fi +# Clean up any mess left over from failed runs. +find results_* -maxdepth 2 ! -name "pkgmaster.devuan.org" -name "*.*" -type d -print0 | xargs -0rt /bin/rm -fr + +if [ "z" != "z${KEEPDAYS}" ] ; then + # Remove old results. + find . -daystart -maxdepth 2 -name "stamp" -type f ! -mtime $((0 - ${KEEPDAYS})) -printf "%h\0" | xargs -0rt /bin/rm -fr +fi + rm ../results; ln -s apt-panopticon/results_old ../results flock -n apt-panopticon.lock ionice -c3 nice -n 19 timeout --kill-after=20.0 --foreground 8.5m ./apt-panopticon.lua && rm apt-panopticon.lock if [ -f apt-panopticon.lock ] ; then @@ -37,3 +48,6 @@ fi rm ../results; ln -s apt-panopticon/results ../results chown -R www-data:www-data * + +# Clean up any mess left over from THIS failed run. +find results_* -maxdepth 2 ! -name "pkgmaster.devuan.org" -name "*.*" -type d -print0 | xargs -0rt /bin/rm -fr -- cgit v1.1