Move scripts to directory

This commit is contained in:
fredbcode committed 2021-12-21 11:20:43 +01:00
1 parent 7566ffcfaf
commit 9547d18ac7
5 files changed
+10 -11

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
horodate=$(date +%d-%m-%Y_%H_%M)
if [ -d $autoreload ] && [ ! -z "$autoreload" ];
then
while inotifywait -e modify,delete,create -r $autoreload --exclude \.swp
do
# wait all modifications
sleep 10
horodate=$(date +%d-%m-%Y_%H_%M)
squid -k reconfigure
echo "RELOAD SQUID $horodate: new files" >> /var/log/squid/reloadsquid.log
sleep 60
done
fi
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
if [ -e "/squid/squid.pid" ];then
echo "Squid pid: Already running ?"
rm /squid/squid.pid
pkill squid
exit 1
fi
chown -R squid /var/log/squid
# Cache exist ?
if [ ! -d "/var/spool/squid/$HOSTNAME" ];then
squid -z -n $HOSTNAME
sleep 5
else
touch "/var/spool/squid/$HOSTNAME"
fi
while test -e /tmp/$HOSTNAME.pid
do
echo "cache is generated/checked"
sleep 1
done
# check sup once before starting
# if env sup
# Run sup: IN BACKGROUND
/squid/sup.sh &
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
echo "Starting: squid"
# Run autoreload: IN BACKGROUND
/squid/autoreload.sh &
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if [ -z "$supgethosts" ] && [ -z "$supicaphost" ]; then
exit 0
fi
while true
do
date=$(date +%d-%m-%Y_%w)
error=0
if [ -n "$supgethosts" ]; then
for i in ${supgethosts[@]}
do
echo "CHECK: $i"
curl -s -o /dev/null --connect-timeout 5 -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/96.0" $i
if [ $? = 0 ];then
echo "SUP: ACCESS ok $i"
if [ -z "$supicaphost" ]; then
exit 0
else
break
fi
else
echo "SUP: ERROR $i"
error=1
fi
done
fi
if [ -n "$supicaphost" ]; then
c-icap-client -i $supicaphost -p $supicapport -s request > /tmp/test-icap-e2g-orion 2>&1
grep "200 OK" /tmp/test-icap-e2g-orion >/dev/null
if [ $? = 0 ];then
echo "SUP ICAP: ACCESS ICAP ok $supicaphost"
exit 0
else
echo "SUP ICAP: ERROR $supicaphost"
error=1
fi
fi
# Sup error because no OK before
if [ "$error" = 1 ];then
echo "SUP ERROR"
squid -k shutdown
exit 1
fi
sleep 120
done