supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: pownernowd run script
Date: Tue, 4 Jul 2006 14:46:48 +0000	[thread overview]
Message-ID: <20060704144648.855.qmail@c8c8d7b954d498.315fe32.mid.smarden.org> (raw)
In-Reply-To: <afacabbe0607030132u584dbdr924fde09ee45a66d@mail.gmail.com>

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.


      reply	other threads:[~2006-07-04 14:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03  8:32 xavier dutoit
2006-07-04 14:46 ` Gerrit Pape [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060704144648.855.qmail@c8c8d7b954d498.315fe32.mid.smarden.org \
    --to=pape@smarden.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).