2021-05-21 11:31:52 +03:00
|
|
|
#!/bin/bash
|
2021-04-23 12:15:19 +03:00
|
|
|
|
2021-12-21 12:20:43 +02:00
|
|
|
if [ -e "/squid/squid.pid" ];then
|
2021-11-15 13:36:40 +02:00
|
|
|
echo "Squid pid: Already running ?"
|
2021-12-21 12:20:43 +02:00
|
|
|
rm /squid/squid.pid
|
2021-11-15 13:36:40 +02:00
|
|
|
pkill squid
|
|
|
|
exit 1
|
2021-04-27 18:10:40 +03:00
|
|
|
fi
|
|
|
|
|
2021-11-22 11:15:28 +02:00
|
|
|
chown -R squid /var/log/squid
|
2021-04-23 12:15:19 +03:00
|
|
|
|
2021-11-22 13:21:36 +02:00
|
|
|
# Cache exist ?
|
|
|
|
if [ ! -d "/var/spool/squid/$HOSTNAME" ];then
|
|
|
|
squid -z -n $HOSTNAME
|
|
|
|
sleep 5
|
|
|
|
else
|
|
|
|
touch "/var/spool/squid/$HOSTNAME"
|
|
|
|
fi
|
|
|
|
|
2021-12-20 20:12:06 +02:00
|
|
|
while test -e /tmp/$HOSTNAME.pid
|
2021-11-22 13:21:36 +02:00
|
|
|
do
|
|
|
|
echo "cache is generated/checked"
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2022-03-17 14:05:08 +02:00
|
|
|
# Run sup: IN BACKGROUND
|
|
|
|
/squid/sup.sh &
|
2022-01-31 12:29:02 +02:00
|
|
|
case $? in
|
|
|
|
1) exit 1;;
|
|
|
|
2) exit 1;;
|
|
|
|
*) echo -e "Sup ok or no sup";;
|
|
|
|
esac
|
|
|
|
shift
|
2021-04-23 12:15:19 +03:00
|
|
|
|
2021-11-22 11:15:28 +02:00
|
|
|
if [ $(grep -c "\-s\ /certs" /etc/squid/squid.conf) -ne 0 ];then
|
|
|
|
if [ ! -d /certs/ssl_db ]; then
|
|
|
|
/usr/lib/squid/security_file_certgen -c -s /certs/ssl_db -M 600MB
|
|
|
|
fi
|
|
|
|
chown -R squid:squid /certs
|
|
|
|
fi
|
2021-04-23 12:15:19 +03:00
|
|
|
|
2021-11-22 11:15:28 +02:00
|
|
|
echo "Starting: squid"
|
|
|
|
# Run autoreload: IN BACKGROUND
|
2021-12-21 12:20:43 +02:00
|
|
|
/squid/autoreload.sh &
|
2021-04-23 12:15:19 +03:00
|
|
|
|