Add new argument NOAUTO (remove scale)
This commit is contained in:
parent
4aed1489ef
commit
53778b2f0a
@ -1,10 +1,12 @@
|
|||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
|
|
||||||
|
ARG SQUID_VERSION
|
||||||
|
ARG NOAUTO
|
||||||
|
|
||||||
ENV SQUID_CACHE_DIR=/var/spool/squid \
|
ENV SQUID_CACHE_DIR=/var/spool/squid \
|
||||||
SQUID_LOG_DIR=/var/log/squid \
|
SQUID_LOG_DIR=/var/log/squid \
|
||||||
SQUID_USER=proxy
|
SQUID_USER=proxy
|
||||||
|
NOAUTO=${NOAUTO}
|
||||||
ARG SQUID_VERSION
|
|
||||||
|
|
||||||
WORKDIR /tmp
|
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 \
|
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
11
run.sh
@ -1,14 +1,21 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
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/$HOSTNAME.pid
|
||||||
|
|
||||||
|
if [ -z $NOAUTO ];then
|
||||||
|
squid -z -n $HOSTNAME
|
||||||
|
squid -N -n $HOSTNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
LIMIT="-cmin +1440"
|
LIMIT="-cmin +1440"
|
||||||
FINDTIME=$(find /var/cache/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT)
|
FINDTIME=$(find /var/cache/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT)
|
||||||
|
|
||||||
chown -R squid /var/log/squid
|
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
|
if [ ! -d "/var/cache/squid/$HOSTNAME" ] || [ ! -z $FINDTIME ];then
|
||||||
squid -z -n $HOSTNAME
|
squid -z -n $HOSTNAME
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -22,7 +29,7 @@ do
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
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
|
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 &
|
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 &
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user