From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1189 Path: news.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: pownernowd run script Date: Tue, 4 Jul 2006 14:46:48 +0000 Message-ID: <20060704144648.855.qmail@c8c8d7b954d498.315fe32.mid.smarden.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1152024402 20978 80.91.229.2 (4 Jul 2006 14:46:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 4 Jul 2006 14:46:42 +0000 (UTC) Original-X-From: supervision-return-1425-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Jul 04 16:46:41 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1FxmAW-0006uj-MV for gcsg-supervision@gmane.org; Tue, 04 Jul 2006 16:46:29 +0200 Original-Received: (qmail 4055 invoked by uid 76); 4 Jul 2006 14:46:49 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 4050 invoked from network); 4 Jul 2006 14:46:48 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1189 Archived-At: On Mon, Jul 03, 2006 at 10:32:26AM +0200, xavier dutoit wrote: > I've written a run script for powernowd (tested on a sarge with > standard package): > > #! /bin/sh > modprobe cpufreq-userspace > if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ] > then > exec /usr/sbin/powernowd -d > else > echo "required sysfs objects not found!" > echo -e "\tRead /usr/share/doc/powernowd/README.Debian for more > information." > fi > > > I wasn't sure about how to deal with error messages if the proc can't > change its frequency. I kept what the init.d script did. If the scaling_governor file does not exist, runit will retry to start the service every second. That's good for temporary errors but not for permanent ones. I'm not sure whether this one is temporary. Additionally modprobe might fail, so, if the absence of scaling_governor is a permanent error, I'd suggest: #!/bin/sh set -e # barf if modprobe fails modprobe cpufreq-userspace test ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor || exec /usr/sbin/powernowd -d echo "required sysfs objects not found!" echo "Read /usr/share/doc/powernowd/README.Debian for more information." sv down "$(pwd)" And note where the echo output goes to. If this service has a log service, the warning goes to the log, if not, it goes to the console. If you redirect the echo output to stderr, the warning would end up in the readproctitle log. HTH, Gerrit.