Add new argument NOAUTO (remove scale)

This commit is contained in:
fredbcode 2021-04-27 17:10:40 +02:00
parent 4aed1489ef
commit 53778b2f0a
2 changed files with 13 additions and 4 deletions

View File

@ -1,10 +1,12 @@
FROM debian:buster
ARG SQUID_VERSION
ARG NOAUTO
ENV SQUID_CACHE_DIR=/var/spool/squid \
SQUID_LOG_DIR=/var/log/squid \
SQUID_USER=proxy
ARG SQUID_VERSION
NOAUTO=${NOAUTO}
WORKDIR /tmp
RUN echo "deb-src http://deb.debian.org/debian buster main contrib" >> /etc/apt/sources.list && apt-get update && apt-get --no-install-recommends -y build-dep squid && apt-get --no-install-recommends -y install wget tar xz-utils libssl-dev libssl1.1 winbind \

11
run.sh
View File

@ -1,14 +1,21 @@
#!/bin/sh
set -vx
# remove previous pid (if exist) after crash
rm /var/run/$HOSTNAME.pid
if [ -z $NOAUTO ];then
squid -z -n $HOSTNAME
squid -N -n $HOSTNAME
fi
LIMIT="-cmin +1440"
FINDTIME=$(find /var/cache/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT)
chown -R squid /var/log/squid
# Si le cache n'existe pas OU rep trop ANCIEN
# Not exist or too old
if [ ! -d "/var/cache/squid/$HOSTNAME" ] || [ ! -z $FINDTIME ];then
squid -z -n $HOSTNAME
sleep 1
@ -22,7 +29,7 @@ do
sleep 1
done
# Find and remove old useless caches directories (not used after limit). Sleep is here to wait for all containers to start.
# 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
sleep 20 && find /var/cache/squid/* -maxdepth 0 -type d $LIMIT -exec rsync -a -v --delete /tmp/empty/ {}/ \; && rm -d /var/cache/squid/* 2>/dev/null &