Date: Fri, 15 Mar 2013 14:57:54 GMT From: Alexander Brovikov <alexander@brovikov.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/176995: [patch] add config testing to net/quagga rc script Message-ID: <201303151457.r2FEvs8F033219@red.freebsd.org> Resent-Message-ID: <201303151500.r2FF08JM057228@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 176995
>Category: misc
>Synopsis: [patch] add config testing to net/quagga rc script
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 15 15:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Alexander Brovikov
>Release: 9.1-RELEASE
>Organization:
>Environment:
FreeBSD XXXXXX 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
>How-To-Repeat:
>Fix:
Attached patch adds config files testing before running start/restart command.
Patch attached with submission follows:
--- /usr/local/etc/rc.d/quagga.orig 2013-03-15 16:49:13.000000000 +0600
+++ /usr/local/etc/rc.d/quagga 2013-03-15 20:50:59.000000000 +0600
@@ -32,6 +32,20 @@
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
+configtest_cmd="check_config"
+extra_commands="configtest"
+
+check_config() {
+ echo Checking $daemon.conf
+ $command $daemon_flags -C
+ result=$?
+ if [ "$result" -eq "0" ]; then
+ echo OK
+ else
+ echo FAILED
+ exit
+ fi
+}
start_postcmd()
{
@@ -61,6 +75,9 @@
command=/usr/local/sbin/${daemon}
required_files=/usr/local/etc/quagga/${daemon}.conf
pidfile=/var/run/quagga/${daemon}.pid
+ if [ ${quagga_cmd} = "restart" -o ${quagga_cmd} = "start" ]; then
+ check_config
+ fi
if [ ${quagga_cmd} = "start" -a ! -f ${required_files} ]; then
continue
fi
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303151457.r2FEvs8F033219>
