HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: /volume1/@appstore/ProxyServer/scripts/cachedir_rebuild.sh
#!/bin/sh

ChrootDir="/var/packages/ProxyServer/target/squid"
BinDir="/var/packages/ProxyServer/target/bin"
LOGDir=${ChrootDir}"/var/logs/"

${BinDir}/squid -z
CACHE_REBUILD_RETRY="30"
while [ "0" -lt "`/usr/bin/ps -ef | /usr/bin/grep -v grep | /usr/bin/grep "squid.*-z" | /usr/bin/wc -l`" ]; do
	if [ "0" -gt "$CACHE_REBUILD_RETRY" ]; then
		echo "Time out: Squid cache rebuild script fail!\n" >> $LOGDir/error.log
		exit 1
	fi
	sleep 1
	CACHE_REBUILD_RETRY="$(($CACHE_REBUILD_RETRY - 1))"
done