From bilbo@hobbiton.org Thu Mar 27 23:23:08 2008 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B50B5106566C for ; Thu, 27 Mar 2008 23:23:08 +0000 (UTC) (envelope-from bilbo@hobbiton.org) Received: from smaug.hobbiton.org (smaug.hobbiton.org [67.132.216.160]) by mx1.freebsd.org (Postfix) with ESMTP id 845C98FC1C for ; Thu, 27 Mar 2008 23:23:08 +0000 (UTC) (envelope-from bilbo@hobbiton.org) Received: by smaug.hobbiton.org (Postfix, from userid 1001) id 2FEF4130C60; Thu, 27 Mar 2008 17:50:34 -0500 (CDT) Message-Id: <20080327225034.2FEF4130C60@smaug.hobbiton.org> Date: Thu, 27 Mar 2008 17:50:34 -0500 (CDT) From: Leif Pedersen Reply-To: Leif Pedersen To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: New feature: Page admin on startup and shutdown X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 122170 >Category: conf >Synopsis: [patch] [request] New feature: notify admin via page on startup and shutdown >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-rc >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Mar 27 23:30:00 UTC 2008 >Closed-Date: >Last-Modified: Fri Mar 28 04:13:01 UTC 2008 >Originator: Leif Pedersen >Release: FreeBSD 7 >Organization: >Environment: >Description: I think it would be appropriate for FreeBSD to include a way of notifying an administrator when a server starts up or shuts down. Attached is an rc.d script I currently add to all my machines. >How-To-Repeat: >Fix: Add /etc/rc.d/sendpage.sh containing the file below. The file is also available temporarily from http://bilbo.hobbiton.org/sendpage.sh #!/bin/sh # # Copyright (c) 2008 Leif Pedersen # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # PROVIDE: sendpage # REQUIRE: LOGIN # BEFORE: # KEYWORD: shutdown # Sends a page to admins when the machine boots or shuts down. Example: # sendpage_enable="YES" # sendpage_command="qpage -f '' -p root" sendpage_enable=${sendpage_enable-"NO"} sendpage_command=${sendpage_command-'read subj; echo $subj | mail -s "$subj" root'} . /etc/rc.subr name="sendpage" rcvar=`set_rcvar` load_rc_config $name start_cmd="sendpage_start" stop_cmd="sendpage_stop" timestamp=`date "+%Y-%m-%d %H:%M"` sendpage_start() { echo "Sending startup page." echo "`hostname -s` coming up at $timestamp" | eval "$sendpage_command" } sendpage_stop() { echo "Sending shutdown page." echo "`hostname -s` going down at $timestamp" | eval "$sendpage_command" } run_rc_command "$1" >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-rc Responsible-Changed-By: linimon Responsible-Changed-When: Fri Mar 28 04:11:49 UTC 2008 Responsible-Changed-Why: Fix up the synopsis a little bit, and assign to maintainers. http://www.freebsd.org/cgi/query-pr.cgi?pr=122170 >Unformatted: