Update run.sh
This commit is contained in:
parent
24bb50e219
commit
4a0583ab59
12
run.sh
12
run.sh
@ -1,22 +1,22 @@
|
||||
#!/bin/sh
|
||||
set -vx
|
||||
# remove previous pid (if exist) after crash
|
||||
rm /var/run/squid.pid
|
||||
rm /var/run/$HOSTNAME.pid
|
||||
|
||||
LIMIT="-cmin +5"
|
||||
FINDTIME=$(find /var/spool/squid/$HOSTNAME/* -maxdepth 0 -type d $LIMIT)
|
||||
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
|
||||
if [ ! -d "/var/spool/squid/$HOSTNAME" ] || [ ! -z $FINDTIME ];then
|
||||
if [ ! -d "/var/cache/squid/$HOSTNAME" ] || [ ! -z $FINDTIME ];then
|
||||
squid -z -n $HOSTNAME
|
||||
sleep 1
|
||||
else
|
||||
touch "/var/spool/squid/$HOSTNAME"
|
||||
touch "/var/cache/squid/$HOSTNAME"
|
||||
fi
|
||||
|
||||
while test -e /var/run/squid.pid
|
||||
while test -e /var/run/$HOSTNAME.pid
|
||||
do
|
||||
echo "cache is generated/checked"
|
||||
sleep 1
|
||||
@ -24,7 +24,7 @@ done
|
||||
|
||||
# Find and remove old useless caches directories (not used after limit). Sleep is here to wait for all containers to start.
|
||||
mkdir /tmp/empty
|
||||
sleep 20 && find /var/spool/squid/* -maxdepth 0 -type d $LIMIT -exec rsync -a -v --delete /tmp/empty/ {}/ \; && rm -d /var/spool/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 &
|
||||
|
||||
squid -N -n $HOSTNAME
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user