misc/176995: [patch] add config testing to net/quagga rc script

Alexander Brovikov alexander at brovikov.ru
Fri Mar 15 15:00:08 UTC 2013


>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 at 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:


More information about the freebsd-bugs mailing list