add a clear squid cache and clean a few things up
This commit is contained in:
parent
882ec74fe0
commit
2d5cfed24a
@ -5,7 +5,7 @@ class god {
|
|||||||
require => Class['ruby']
|
require => Class['ruby']
|
||||||
}
|
}
|
||||||
|
|
||||||
$bin = "${ruby::path}//god"
|
$bin = "${ruby::path}/god"
|
||||||
$dir = config_path("god.d")
|
$dir = config_path("god.d")
|
||||||
$pid = pid_path($name)
|
$pid = pid_path($name)
|
||||||
$log = log_path($name)
|
$log = log_path($name)
|
||||||
|
@ -72,6 +72,11 @@ class squid($version = '', $user = 'proxy', $group = 'proxy', $config_template,
|
|||||||
path => $::base::path
|
path => $::base::path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { "${sbin}/clear-squid-cache":
|
||||||
|
content => template('squid/clear-squid-cache'),
|
||||||
|
mode => 0755
|
||||||
|
}
|
||||||
|
|
||||||
exec { 'cache_dir_perms_again':
|
exec { 'cache_dir_perms_again':
|
||||||
command => "chown -R ${user}:${group} ${cache_dir}",
|
command => "chown -R ${user}:${group} ${cache_dir}",
|
||||||
path => $::base::path,
|
path => $::base::path,
|
||||||
|
20
shared/additional-modules/squid/templates/clear-squid-cache
Normal file
20
shared/additional-modules/squid/templates/clear-squid-cache
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/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"
|
@ -1,4 +1,4 @@
|
|||||||
<%= scope.function_template('base/init-d-header') %>
|
<%= scope.function_template([ 'base/init-d-header' ]) %>
|
||||||
|
|
||||||
<%= init_d_prolog %>
|
<%= init_d_prolog %>
|
||||||
<%= init_d_prerun %>
|
<%= init_d_prerun %>
|
||||||
@ -19,5 +19,5 @@ stop() {
|
|||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
<%= scope.function_template('base/init-d-actions') %>
|
<%= scope.function_template([ 'base/init-d-actions' ]) %>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ define remotedeb($url, $version) {
|
|||||||
|
|
||||||
exec { "remotedeb-${name}":
|
exec { "remotedeb-${name}":
|
||||||
command => "curl -o ${deb} ${url} && dpkg -i ${deb}",
|
command => "curl -o ${deb} ${url} && dpkg -i ${deb}",
|
||||||
unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -eq 0",
|
unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -ne 0",
|
||||||
path => $base::path
|
path => $base::path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \
|
|||||||
--confdir=$PWD \
|
--confdir=$PWD \
|
||||||
--modulepath=$PWD/modules:$PWD/shared/modules:$PWD/shared/additional-modules \
|
--modulepath=$PWD/modules:$PWD/shared/modules:$PWD/shared/additional-modules \
|
||||||
--templatedir=$PWD/shared/templates:$PWD/templates \
|
--templatedir=$PWD/shared/templates:$PWD/templates \
|
||||||
-v $@ \
|
-v --no-report $@ \
|
||||||
manifests/site.pp
|
manifests/site.pp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user