Update run.sh and push only master branch to docker hub
This commit is contained in:
parent
9b7403d7d2
commit
266890e5cf
@ -99,7 +99,7 @@ RUN adduser --no-create-home --uid 1161 --group --system squid \
|
||||
&& echo "cache_log /var/log/squid/cache.log" >> /etc/squid/squid.conf \
|
||||
&& echo "cache_effective_user squid" >> /etc/squid/squid.conf \
|
||||
# Packages dependencies installation for running and clean again
|
||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates net-tools rsync libexpat1 libltdl7 libxml2 openssl ca-certificates libldap-2.4-2 libecap3 libcap2 libdb5.3 libatomic1 dumb-init \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates net-tools rsync libexpat1 libltdl7 libxml2 openssl ca-certificates libldap-2.4-2 libecap3 libcap2 libdb5.3 libatomic1 dumb-init procps \
|
||||
&& apt-get auto-remove -y && apt-get clean autoclean \
|
||||
&& rm -rf /var/lib/apt/lists/* && rm -Rf /tmp/*
|
||||
COPY run.sh /
|
||||
|
||||
@ -71,3 +71,5 @@ push-docker-hub-arm:
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
needs: ["docker-hub-test-arm"]
|
||||
only:
|
||||
- master
|
||||
|
||||
@ -65,3 +65,6 @@ push-docker-hub:
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
needs: ["docker-hub-test"]
|
||||
only:
|
||||
- master
|
||||
|
||||
|
||||
29
run.sh
29
run.sh
@ -1,36 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -vx
|
||||
# remove previous pid (if exist) after crash
|
||||
rm /var/run/squid.pid
|
||||
|
||||
if [ $NOAUTO == "yes" ];then
|
||||
squid -z -n $HOSTNAME
|
||||
squid -N -n $HOSTNAME
|
||||
if [ -e "/run/squid.pid" ];then
|
||||
echo "Squid pid: Already running ?"
|
||||
rm /run/squid.pid
|
||||
pkill squid
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# + 48h
|
||||
LIMIT="-cmin +2880"
|
||||
|
||||
# le cache contient des repertoires pas utilisés depuis plus de $LIMIT
|
||||
# Check si Au demarrage le cache contient des repertoires pas utilisés depuis plus de $LIMIT
|
||||
FINDTIME=$(find /var/spool/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT | wc -l)
|
||||
# Combien de rep en tout
|
||||
# Combien de rep global
|
||||
NOWREP=$(find /var/spool/squid/$HOSTNAME/* -maxdepth 0 -type d | wc -l)
|
||||
|
||||
chown -R squid /var/log/squid
|
||||
|
||||
# Not exist or too old
|
||||
if [ ! -d "/var/spool/squid/$HOSTNAME" ] || [ $FINDTIME == $NOWREP ];then
|
||||
# On genere/regenere
|
||||
squid -z -n $HOSTNAME
|
||||
sleep 5
|
||||
sleep 1
|
||||
else
|
||||
# Remet à zero la date du rep de cache pour le prochain check
|
||||
touch "/var/spool/squid/$HOSTNAME"
|
||||
fi
|
||||
|
||||
while test -e /var/run/squid.pid
|
||||
while test -e /var/run/squid.pid
|
||||
do
|
||||
echo "cache is generated/checked"
|
||||
echo "cache is generated/checked"
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
# Find and remove old useless caches directories (not used after "LIMIT" value). sleep is only used to wait other containers are well started.
|
||||
mkdir /tmp/empty
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user