Update auto cache + debian slim
This commit is contained in:
parent
ac77c61934
commit
3702136133
@ -1,4 +1,4 @@
|
|||||||
FROM debian:buster
|
FROM debian:stable-slim
|
||||||
|
|
||||||
ARG SQUID_VERSION
|
ARG SQUID_VERSION
|
||||||
ENV ENV_SQUID_VERSION=$SQUID_VERSION
|
ENV ENV_SQUID_VERSION=$SQUID_VERSION
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
FROM debian:buster
|
FROM debian:stable-slim
|
||||||
|
|
||||||
ARG SQUID_VERSION
|
ARG SQUID_VERSION
|
||||||
ENV ENV_SQUID_VERSION=$SQUID_VERSION
|
ENV ENV_SQUID_VERSION=$SQUID_VERSION
|
||||||
|
|||||||
21
run.sh
21
run.sh
@ -1,33 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -vx
|
set -vx
|
||||||
|
|
||||||
# remove previous pid (if exist) after crash
|
# remove previous pid (if exist) after crash
|
||||||
rm /var/run/$HOSTNAME.pid
|
rm /var/run/squid.pid
|
||||||
|
|
||||||
if [ $NOAUTO == "yes" ];then
|
if [ $NOAUTO == "yes" ];then
|
||||||
squid -z -n $HOSTNAME
|
squid -z -n $HOSTNAME
|
||||||
squid -N -n $HOSTNAME
|
squid -N -n $HOSTNAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# + 48h
|
||||||
|
LIMIT="-cmin +2880"
|
||||||
|
|
||||||
LIMIT="-cmin +1440"
|
# le cache contient des repertoires pas utilisés depuis plus de $LIMIT
|
||||||
FINDTIME=$(find /var/cache/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT)
|
FINDTIME=$(find /var/spool/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT | wc -l)
|
||||||
|
# Combien de rep en tout
|
||||||
|
NOWREP=$(find /var/spool/squid/$HOSTNAME/* -maxdepth 0 -type d | wc -l)
|
||||||
|
|
||||||
chown -R squid /var/log/squid
|
chown -R squid /var/log/squid
|
||||||
|
|
||||||
# Not exist or too old
|
# Not exist or too old
|
||||||
if [ ! -d "/var/cache/squid/$HOSTNAME" ] || [ ! -z $FINDTIME ];then
|
if [ ! -d "/var/spool/squid/$HOSTNAME" ] || [ $FINDTIME == $NOWREP ];then
|
||||||
squid -z -n $HOSTNAME
|
squid -z -n $HOSTNAME
|
||||||
sleep 1
|
sleep 5
|
||||||
else
|
else
|
||||||
touch "/var/cache/squid/$HOSTNAME"
|
touch "/var/spool/squid/$HOSTNAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while test -e /var/run/$HOSTNAME.pid
|
while test -e /var/run/squid.pid
|
||||||
do
|
do
|
||||||
echo "cache is generated/checked"
|
echo "cache is generated/checked"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Find and remove old useless caches directories (not used after limi valuet). sleep is only used to wait other containers are well started.
|
# Find and remove old useless caches directories (not used after limi valuet). sleep is only used to wait other containers are well started.
|
||||||
mkdir /tmp/empty
|
mkdir /tmp/empty
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user