diff options
author | onefang | 2023-05-11 15:24:15 +1000 |
---|---|---|
committer | onefang | 2023-05-11 15:24:15 +1000 |
commit | 9967b8231a083c630eea042ce93c2b003ee892c1 (patch) | |
tree | 64ac9a39176625bc011f2e63dd17a67e5a57e88a | |
parent | Update base-files version. (diff) | |
download | apt-panopticon-9967b8231a083c630eea042ce93c2b003ee892c1.zip apt-panopticon-9967b8231a083c630eea042ce93c2b003ee892c1.tar.gz apt-panopticon-9967b8231a083c630eea042ce93c2b003ee892c1.tar.bz2 apt-panopticon-9967b8231a083c630eea042ce93c2b003ee892c1.tar.xz |
Clean up messes and old results.
-rwxr-xr-x | update_apt-panopticon | 18 |
1 files changed, 16 insertions, 2 deletions
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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | cd /var/www/html/apt-panopticon/apt-panopticon_cgp | 3 | PANOPATH="/var/www/html/apt-panopticon" |
4 | #KEEPDAYS=$((2 * 30)) | ||
5 | |||
6 | cd ${PANOPATH}/apt-panopticon_cgp | ||
4 | if [ -d .git ] ; then | 7 | if [ -d .git ] ; then |
5 | git pull > /dev/null | 8 | git pull > /dev/null |
6 | chown -R www-data:www-data * | 9 | chown -R www-data:www-data * |
7 | fi | 10 | fi |
8 | cd /var/www/html/apt-panopticon/apt-panopticon | 11 | cd ${PANOPATH}/apt-panopticon |
9 | if [ -d .git ] ; then | 12 | if [ -d .git ] ; then |
10 | git pull > /dev/null | 13 | git pull > /dev/null |
11 | chown -R www-data:www-data * | 14 | chown -R www-data:www-data * |
@@ -28,6 +31,14 @@ if [ -f apt-panopticon.lock ] ; then | |||
28 | rm apt-panopticon.lock | 31 | rm apt-panopticon.lock |
29 | fi | 32 | fi |
30 | 33 | ||
34 | # Clean up any mess left over from failed runs. | ||
35 | find results_* -maxdepth 2 ! -name "pkgmaster.devuan.org" -name "*.*" -type d -print0 | xargs -0rt /bin/rm -fr | ||
36 | |||
37 | if [ "z" != "z${KEEPDAYS}" ] ; then | ||
38 | # Remove old results. | ||
39 | find . -daystart -maxdepth 2 -name "stamp" -type f ! -mtime $((0 - ${KEEPDAYS})) -printf "%h\0" | xargs -0rt /bin/rm -fr | ||
40 | fi | ||
41 | |||
31 | rm ../results; ln -s apt-panopticon/results_old ../results | 42 | rm ../results; ln -s apt-panopticon/results_old ../results |
32 | 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 | 43 | 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 |
33 | if [ -f apt-panopticon.lock ] ; then | 44 | if [ -f apt-panopticon.lock ] ; then |
@@ -37,3 +48,6 @@ fi | |||
37 | rm ../results; ln -s apt-panopticon/results ../results | 48 | rm ../results; ln -s apt-panopticon/results ../results |
38 | 49 | ||
39 | chown -R www-data:www-data * | 50 | chown -R www-data:www-data * |
51 | |||
52 | # Clean up any mess left over from THIS failed run. | ||
53 | find results_* -maxdepth 2 ! -name "pkgmaster.devuan.org" -name "*.*" -type d -print0 | xargs -0rt /bin/rm -fr | ||