add support for tc shaping
This commit is contained in:
parent
775dedf53b
commit
c540794dd1
@ -46,29 +46,15 @@ start() {
|
||||
umask 027
|
||||
ulimit -n 65535
|
||||
$BIN $ARGS
|
||||
chown <%= scope.lookupvar('squid::user') %> $PID
|
||||
RETVAL=$?
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
PIDID=`cat $PID 2>/dev/null`
|
||||
|
||||
if [ -f $PID ]; then
|
||||
kill $PIDID
|
||||
fi
|
||||
|
||||
cnt=0
|
||||
while kill -0 $PIDID 2>/dev/null
|
||||
do
|
||||
cnt=`expr $cnt + 1`
|
||||
if [ $cnt -gt 24 ]
|
||||
then
|
||||
RETVAL=1
|
||||
return RETVAL
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
$BIN $ARGS -k shutdown
|
||||
$BIN $ARGS -k kill
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
9
shared/additional-modules/tc/manifests/debian.pp
Normal file
9
shared/additional-modules/tc/manifests/debian.pp
Normal file
@ -0,0 +1,9 @@
|
||||
class tc::debian($config) {
|
||||
$packages = [ 'ethtool' ]
|
||||
|
||||
init_d_bundle { 'tc':
|
||||
init_d_prolog => template('tc/debian/init-d-prolog'),
|
||||
init_d_prerun => template('tc/debian/init-d-prerun'),
|
||||
require => Class['squid']
|
||||
}
|
||||
}
|
0
shared/additional-modules/tc/manifests/init.pp
Normal file
0
shared/additional-modules/tc/manifests/init.pp
Normal file
@ -0,0 +1,8 @@
|
||||
### BEGIN INIT INFO
|
||||
# Provides: tc
|
||||
# Required-Start: $local_fs $remote_fs $network
|
||||
# Required-Stop: $local_fs $remote_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Traffic shaping
|
||||
### END INIT INFO
|
23
shared/additional-modules/tc/templates/tc-init.d
Normal file
23
shared/additional-modules/tc/templates/tc-init.d
Normal file
@ -0,0 +1,23 @@
|
||||
<%= scope.function_template('base/init-d-header') %>
|
||||
|
||||
<%= init_d_prolog %>
|
||||
<%= init_d_prerun %>
|
||||
|
||||
start() {
|
||||
echo -n "Starting $NAME: "
|
||||
|
||||
<%= scope.lookupvar('tc::debian::config') %>
|
||||
|
||||
echo "done"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $NAME: "
|
||||
|
||||
tc qdisc del dev eth0 root
|
||||
|
||||
echo "done"
|
||||
}
|
||||
|
||||
<%= scope.function_template('base/init-d-actions') %>
|
||||
|
@ -1,3 +0,0 @@
|
||||
DAEMON_OPTS="\
|
||||
"
|
||||
|
Loading…
Reference in New Issue
Block a user