puppet-standalone-mashup/additional-modules/squid/templates/clear-squid-cache

21 lines
336 B
Bash

#!/bin/bash
target="<%= @cache_dir %>$(date +%Y%m%d%H%M%S)"
if [ $UID -ne 0 ]; then
sudo $0
exit
fi
god stop squid
while [ "$(pgrep squid3 | wc -l)" -ne 0 ]; do
sleep 1
done
mv <%= @cache_dir %> "$target"
mkdir <%= @cache_dir %>
chown -R <%= @user %>:<%= @group %> <%= @cache_dir %>
squid3 -z
god start squid
rm -Rf "$target"