From nobody@FreeBSD.org  Fri Sep  9 17:22:41 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C22F0106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Sep 2011 17:22:41 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 981338FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Sep 2011 17:22:41 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p89HMfth010834
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 9 Sep 2011 17:22:41 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p89HMf0R010821;
	Fri, 9 Sep 2011 17:22:41 GMT
	(envelope-from nobody)
Message-Id: <201109091722.p89HMf0R010821@red.freebsd.org>
Date: Fri, 9 Sep 2011 17:22:41 GMT
From: Michael Scheidell <scheidell@secnap.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sysutils/freeipmi   Add bmc-watchdog.rc
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         160592
>Category:       ports
>Synopsis:       sysutils/freeipmi   Add bmc-watchdog.rc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sunpoet
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 09 17:30:08 UTC 2011
>Closed-Date:    Tue Feb 07 10:56:45 UTC 2012
>Last-Modified:  Tue Feb 07 10:56:45 UTC 2012
>Originator:     Michael Scheidell
>Release:        7,3, 7,4, etc
>Organization:
SECNAP Network Security
>Environment:
lots of them
>Description:
freeipmi comes with a bmc-watchdog (if you have ipmi/bmc on board)

this uses a hardware watchdog timer, rather then (just) the kernel 'watchdog' daemon.  (if the system is locked up, the kernel might not be able to trigger a reboot anyway)

All this patch does is add a ../rc.d/bmc-watchdog rc script.

options taken from Linux freeipmi-bmc-watchdog /etc/init.d/ script.

been using this for several months.
note, there WAS a strange bug in 1.0.5 that made SOME dell systems reset.
this is not the case with 1.0.6.
also note:
it would be MUCH BETTER if the kernel watchdog could soft boot/sync fsys, but failing that, maybe a hard reset is in order for critical systems.

>How-To-Repeat:
na
>Fix:
apply patch. (adds rc script)

not sure if this needs a portsbump, since if someone is already using freeipmi, then don't need to install this.



Patch attached with submission follows:

diff -bBru /var/tmp/freeipmi/files/bmc-watchdog.in ./files/bmc-watchdog.in
--- /var/tmp/freeipmi/files/bmc-watchdog.in	2011-09-09 13:07:02.000000000 -0400
+++ ./files/bmc-watchdog.in	2011-09-09 13:06:14.000000000 -0400
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+
+# PROVIDE: bmc_watchdog
+# REQUIRE: devfs
+# KEYWORD: nojail shutdown
+#
+# Add the following line to /etc/rc.conf to enable bmc-watchdog:
+#
+# bmc_watchdog_enable="YES"
+#
+bmc_watchdog_enable=${bmc_watchdog_enable:-"NO"}
+# This will prevent reboot loops.
+bmc_watchdog_failsafe=${bmc_watchdog_failsafe:-"YES"}
+#
+# see bmc-watchdog(8) for flags
+. /etc/rc.subr
+
+name=bmc_watchdog
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/bmc-watchdog
+bmc_watchdog_log=${bmc_watchdog_log:-"/var/log/freeipmi/bmc-watchdog.log"}
+bmc_watchdog_flags=${bmc_watchdog_flags:-"-d -u 4 -p 0 -a 1 -F -P -L -S -O -i 900 -e 60}"
+bmc_watchdog_flags="${bmc_watchdog_flags} -f ${bmc_watchdog_log}"
+
+start_precmd=start_precmd
+stop_precmd=stop_precmd
+
+start_precmd() {
+ ${command} -y
+ if checkyesno bmc_watchdog_failsafe ;then
+  if tail -1 ${bmc_watchdog_log} 2>/dev/null | grep ": starting bmc-watchdog daemon$" >/dev/null 2>&1; then
+    date -j +"[%b %e %X]: failsafe bmc-watchdog daemon" >> ${bmc_watchdog_log}
+    err 1 "Fail Safe:  System Crash.  Not starting bmc-watchdog"
+  fi
+ fi
+return 0
+}
+
+stop_precmd() {
+  ${command} -y
+}
+  
+load_rc_config $name
+run_rc_command "$1"


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->sunpoet 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Sep 9 17:30:20 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160592 

From: Michael Scheidell <michael.scheidell@secnap.com>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: ports/160592: sysutils/freeipmi   Add bmc-watchdog.rc
Date: Fri, 9 Sep 2011 14:39:37 -0400

 comment to my own pr:
 seems that the OS watchdog/(d) will use the IPMI / bmc watchdog:
 
 <http://freebsd.1045724.n5.nabble.com/Enabling-watchdog-td3973447.html>
 
 BUT.. doesn't load ipmi.ko (unless it was in kernel)
 
 so, options:  compile in SOFTWARE WATCHDOG in kernel, or ipmi.
 
 ls /dev/ip*
 ls: No match.
 # /etc/rc.d/watchdogd forcestart
 Starting watchdogd.
 # /etc/rc.d/watchdogd forcestatus
 watchdogd is not running.
 # /etc/rc.d/watchdogd onestart
 Starting watchdogd.
 # /etc/rc.d/watchdogd forcestatus
 watchdogd is not running.
 
 -- 
 Michael Scheidell, CTO
 o: 561-999-5000
 d: 561-948-2259
  >*| *SECNAP Network Security Corporation
 
     * Best Mobile Solutions Product of 2011
     * Best Intrusion Prevention Product
     * Hot Company Finalist 2011
     * Best Email Security Product
     * Certified SNORT Integrator
 
 ______________________________________________________________________
 This email has been scanned and certified safe by SpammerTrap(r). 
 For Information please see http://www.spammertrap.com/
 ______________________________________________________________________  
   

From: Michael Scheidell <michael.scheidell@secnap.com>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: ports/160592: sysutils/freeipmi   Add bmc-watchdog.rc
Date: Fri, 9 Sep 2011 16:08:30 -0400

 patch to my patch:
 add this to start_precmd()
 
   if checkyesno watchdogd ; then
     err 1 Cannot run both bmc-watchdog and watchdogd
   fi
   load_kld ipmi
 
 this should prevent them from both running, which could cause problems 
 is the sleep/and interval's conflict., and the load_kld will load ipmi 
 if it was compiled as a module.
 
 note:
 watchdogd WILL attach to the ipmi/bmc timer if the hardware supports 
 it.  and, if the hardware DOESNT' support it, bmc-watchdog won't run anyway.
 
 
 -- 
 Michael Scheidell, CTO
 o: 561-999-5000
 d: 561-948-2259
  >*| *SECNAP Network Security Corporation
 
     * Best Mobile Solutions Product of 2011
     * Best Intrusion Prevention Product
     * Hot Company Finalist 2011
     * Best Email Security Product
     * Certified SNORT Integrator
 
 ______________________________________________________________________
 This email has been scanned and certified safe by SpammerTrap(r). 
 For Information please see http://www.spammertrap.com/
 ______________________________________________________________________  
   
State-Changed-From-To: open->closed 
State-Changed-By: scheidell 
State-Changed-When: Tue Feb 7 10:56:45 UTC 2012 
State-Changed-Why:  
bmc-watchdog will segv too much. use built in watchdogd 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160592 
>Unformatted:
