From owner-svn-src-head@FreeBSD.ORG Sat Jul 27 22:23:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6E683E02; Sat, 27 Jul 2013 22:23:33 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3FBF827BB; Sat, 27 Jul 2013 22:23:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6RMNXi4053106; Sat, 27 Jul 2013 22:23:33 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6RMNXBL053105; Sat, 27 Jul 2013 22:23:33 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201307272223.r6RMNXBL053105@svn.freebsd.org> From: Alfred Perlstein Date: Sat, 27 Jul 2013 22:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253723 - head/usr.sbin/watchdogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 22:23:33 -0000 Author: alfred Date: Sat Jul 27 22:23:32 2013 New Revision: 253723 URL: http://svnweb.freebsd.org/changeset/base/253723 Log: Provide some examples for watchdogd usage. Modified: head/usr.sbin/watchdogd/watchdogd.8 Modified: head/usr.sbin/watchdogd/watchdogd.8 ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.8 Sat Jul 27 22:21:10 2013 (r253722) +++ head/usr.sbin/watchdogd/watchdogd.8 Sat Jul 27 22:23:32 2013 (r253723) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 5, 2013 +.Dd July 27, 2013 .Dt WATCHDOGD 8 .Os .Sh NAME @@ -204,6 +204,81 @@ and the kernel .Xr log 4 device for .Xr syslog 8 . +.Sh EXAMPLES +.Ss Debugging watchdogd and/or your watchdog script. +.Pp +This is a useful recipe for debugging watchdogd and your watchdog +script. +.Pp +(Note that ^C works oddly because watchdogd calls system(3) so the +first ^C will terminate the "sleep" command.) +.Pp +.Pp +Explanation of options used: +.Bl -enum -offset indent -compact +.It +Set Debug on (--debug) +.It +Set the watchdog to trip at 30 seconds. (-t 30) +.It +Use of a softtimeout: +.Bl -enum -offset indent -compact -nested +.It +Use a softtimeout (don't arm the hardware watchdog) (--softtimeout) +.It +Set the softtimeout action to do both kernel printf(9) and log(9) when it trips. (--softtimeout-action log,printf) +.El +.It +Use of a pre-timeout: +.Bl -enum -offset indent -compact -nested +.It +Set a pre-timeout of 15 seconds (this will later trigger a panic/dump) (--pretimeout 15) +.It +Set the action to also kernel printf(9) and log(9) when it trips. (--pretimeout-action log,printf) +.El +.It +Use of a script: +.Bl -enum -offset indent -compact -nested +.It +Run "sleep 60" as a shell command that acts as the watchdog (-e 'sleep 60') +.It +Warn us when the script takes longer than 1 second to run (-w) +.El +.El +.Bd -literal +watchdogd --debug -t 30 \\ + --softtimeout --softtimeout-action log,printf \\ + --pretimeout 15 --pretimeout-action log,printf \\ + -e 'sleep 60' -w +.Ed +.Ss Production use of example +.Bl -enum -offset indent -compact +.It +Set hard timeout to 120 seconds (-t 120) +.It +Set a panic to happen at 60 seconds (to trigger a +.Xr crash 8 +for dump analysis): +.Bl -enum -offset indent -compact -nested +.It +Use of pre-timeout (--pretimeout 60) +.It +Specify pre-timeout action (--pretimeout-action log,printf,panic ) +.El +.It +Use of a script: +.Bl -enum -offset indent -compact -nested +.It +Run your script (-e '/path/to/your/script 60') +.It +Log if your script takes a longer than 15 seconds to run time. (-w -T 15) +.El +.El +.Bd -literal +watchdogd -t 120 \\ + --pretimeout 60 --pretimeout-action log,printf,panic \\ + -e '/path/to/your/script 60' -w -T 15 +.Ed .Sh FILES .Bl -tag -width ".Pa /var/run/watchdogd.pid" -compact .It Pa /var/run/watchdogd.pid