* [LARTC] init scripts to use and save iproute and tc rules
@ 2002-11-25 16:08 Luis Miguel Cruz Miranda
2002-11-25 16:26 ` Stef Coene
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luis Miguel Cruz Miranda @ 2002-11-25 16:08 UTC (permalink / raw)
To: lartc
Where can I find any init scripts to use and save iproute and tc rules?
Luis Miguel Cruz Miranda.
CCNA - Systems Administrator
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LARTC] init scripts to use and save iproute and tc rules
2002-11-25 16:08 [LARTC] init scripts to use and save iproute and tc rules Luis Miguel Cruz Miranda
@ 2002-11-25 16:26 ` Stef Coene
2002-11-26 7:32 ` Tarek W.
2002-11-26 8:04 ` raptor
2 siblings, 0 replies; 4+ messages in thread
From: Stef Coene @ 2002-11-25 16:26 UTC (permalink / raw)
To: lartc
On Monday 25 November 2002 17:08, Luis Miguel Cruz Miranda wrote:
> Where can I find any init scripts to use and save iproute and tc rules?
There is no such script.
Stef
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LARTC] init scripts to use and save iproute and tc rules
2002-11-25 16:08 [LARTC] init scripts to use and save iproute and tc rules Luis Miguel Cruz Miranda
2002-11-25 16:26 ` Stef Coene
@ 2002-11-26 7:32 ` Tarek W.
2002-11-26 8:04 ` raptor
2 siblings, 0 replies; 4+ messages in thread
From: Tarek W. @ 2002-11-26 7:32 UTC (permalink / raw)
To: lartc
I personally put before the touch'ing of lock files in
/etc.rc.d/init.d/network in the "start" section, and their deletion in
the same under the "stop" case also before the removal of the lock file
On Mon, 2002-11-25 at 14:08, Luis Miguel Cruz Miranda wrote:
> Where can I find any init scripts to use and save iproute and tc rules?
>
>
> Luis Miguel Cruz Miranda.
> CCNA - Systems Administrator
>
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LARTC] init scripts to use and save iproute and tc rules
2002-11-25 16:08 [LARTC] init scripts to use and save iproute and tc rules Luis Miguel Cruz Miranda
2002-11-25 16:26 ` Stef Coene
2002-11-26 7:32 ` Tarek W.
@ 2002-11-26 8:04 ` raptor
2 siblings, 0 replies; 4+ messages in thread
From: raptor @ 2002-11-26 8:04 UTC (permalink / raw)
To: lartc
|Where can I find any init scripts to use and save iproute and tc rules?
]- here is one for tcng for mandrake, u can easly change it for tc (just edit start() ) to suit your needs
#!/bin/sh
#
# tcng: Starts the tcng Server
#
# Version: @(#) /etc/rc.d/init.d/tcng 0.1
#
# chkconfig: 2345 90 10
# description: Starts and stops the tcng at boot time and shutdown.
#
# processname: tcng
#
# created : from Raptor
#
#path to the tc command
tc=/sbin/tc
#path to the tcc command
tcc=/arh/bin/com.pl
#where is the tcng config file
tcngConf=/path/tcng/blah.tcng
offMsg=OFF
onMsg=ON
debug=1
# Source function library.
. /etc/rc.d/init.d/functions
isUp () {
res=`$tc qdisc show dev $1`
if [ -z "$res" ]; then return 1; fi
return 0
}
start () {
gprintf "Starting tcng services: "; echo
OLDIFS="$IFS"
IFS="
"
cmds=`$tcc $tcngConf | grep -v "^#" | sed -e "s/^tc//"`
for cmd in $cmds; do
[ $debug -eq 1 ] && gprintf "Execute : $cmd:" && echo;
eval "$tc $cmd"
done
touch /var/lock/subsys/tcng
IFS="$OLDIFS"
}
stop () {
gprintf "Stopping some/all tcng services: "
echo
#if explictly specified shut only these devices
[ "$1" ] && devs=$*;
# echo $devs
for d in $devs; do
if isUp $d ; then
gprintf "Flushing : $d"; echo
$tc qdisc del dev $d root
else gprintf "No traffic control running on : $d"; echo
fi
# rm -f /var/lock/subsys/tcng-$d
done
rm -f /var/lock/subsys/tcng;#this is not the correct behavior
}
status () {
[ "$1" ] && devs=$*;
# echo $devs
for d in $devs; do
if isUp $d ;
then gprintf "traffic control on $d : [$onMsg]"; echo;
else gprintf "traffic control on $d: [$offMsg]"; echo;
fi
done
}
show () {
if [ -z "$1" ]; then what=all; else what=$1; fi
shift
if [ "$1" ]; then devs=$*; fi
for d in $devs; do
if isUp $d; then
[ "$what" = "all" ] || [ "$what" = "qdisc" ] && gprintf "`$tc qdisc show dev $d`"; echo
[ "$what" = "all" ] || [ "$what" = "class" ] && gprintf "`$tc class show dev $d`"; echo
[ "$what" = "all" ] || [ "$what" = "filter" ] && gprintf "`$tc filter show dev $d`"; echo
fi
done
}
parse () {
echo "$1" | perl -ne '
$_ =~ s/(\d+?:\d+?)/$1/gs;
print $_
'
}
stat () {
[ -z "$1" ] || [ -z "$2" ] && gprintf "qdisc|class or device has to be specified !!!" && echo && exit;
parse "`$tc -s $1 show dev $2`"
}
devs=`ifconfig -a | grep '^\w' | grep -v lo | cut -f 1 -d ' '`
command=$1
shift;
case "$command" in
start) start ;;
stop) stop $@ ;;
status) status $@ ;;
show) show $@ ;;
stat) stat $@ ;;
restart)
gprintf "Restarting tcng. "; echo
stop $@
start $@
;;
*)
gprintf "*** Usage:
tcng {start|stop|status|restart} [devices]
tcng show [all|qdisc|class|filter] [devices]
tcng stat [qdisc|class] [devices]
"; echo
exit 1
esac
exit 0
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-11-26 8:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-25 16:08 [LARTC] init scripts to use and save iproute and tc rules Luis Miguel Cruz Miranda
2002-11-25 16:26 ` Stef Coene
2002-11-26 7:32 ` Tarek W.
2002-11-26 8:04 ` raptor
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.