* [lm-sensors] fancontrol init script for ubuntu +
@ 2009-01-21 6:30 Charles
2009-01-23 19:59 ` Mark Nienberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Charles @ 2009-01-21 6:30 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1: Type: text/plain, Size: 413 bytes --]
Hello lmsensors mailing list :-)
Here's a standards-compliant init script for fancontrol, developed and
tested using fancontrol 0.66 on ubuntu 8.04.1. It may work on other ubuntus,
debian and other debian-based systems using lsb-base (>= 3.0-6).
Part of the standards-compliance is that the script issues no messages at
boot or shutdown if /etc/default/rcS has VERBOSE=no (the default value).
Best
Charles
[-- Attachment #2: fancontrol --]
[-- Type: application/octet-stream, Size: 3147 bytes --]
#! /bin/sh
# fancontrol startup script
# fancontrol is part of the lm-sensors package
# Developed and tested using fancontrol 0.66 on ubuntu 8.04.1; may work
# on other ubuntus, debian and other debian-based systems using
# lsb-base (>= 3.0-6)
# INIT INFO for insserv and YaST
### BEGIN INIT INFO
# Provides: fancontrol
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: fancontrol
# Description: fan control
### END INIT INFO
# Change History
# 20jan09 Charles
# * Creation on ubuntu 8.04.1 with lm-sensors 1:3.0.0-4ubuntu2,
# using skeleton 1.8 as a pro-forma with minimal functional change
# PATH is not set because no reason to change what init provides
DESC="fan controller"
NAME=fancontrol
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
# fancontrol does not background itself so start-stop-daemon's -b option used
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon -b --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon -b --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
[-- Attachment #3: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] fancontrol init script for ubuntu +
2009-01-21 6:30 [lm-sensors] fancontrol init script for ubuntu + Charles
@ 2009-01-23 19:59 ` Mark Nienberg
2009-01-25 1:50 ` Volker Kuhlmann
2009-01-25 2:01 ` Volker Kuhlmann
2 siblings, 0 replies; 4+ messages in thread
From: Mark Nienberg @ 2009-01-23 19:59 UTC (permalink / raw)
To: lm-sensors
Charles wrote:
> Hello lmsensors mailing list :-)
>
> Here's a standards-compliant init script for fancontrol, developed and
> tested using fancontrol 0.66 on ubuntu 8.04.1. It may work on other ubuntus,
> debian and other debian-based systems using lsb-base (>= 3.0-6).
>
> Part of the standards-compliance is that the script issues no messages at
> boot or shutdown if /etc/default/rcS has VERBOSE=no (the default value).
Does anyone have a similar init script for fancontrol on redhat/centos/fedora?
Thanks,
Mark Nienberg
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] fancontrol init script for ubuntu +
2009-01-21 6:30 [lm-sensors] fancontrol init script for ubuntu + Charles
2009-01-23 19:59 ` Mark Nienberg
@ 2009-01-25 1:50 ` Volker Kuhlmann
2009-01-25 2:01 ` Volker Kuhlmann
2 siblings, 0 replies; 4+ messages in thread
From: Volker Kuhlmann @ 2009-01-25 1:50 UTC (permalink / raw)
To: lm-sensors
On Wed 21 Jan 2009 19:18:31 NZDT +1300, Charles wrote:
> Here's a standards-compliant init script for fancontrol, developed and
> tested using fancontrol 0.66 on ubuntu 8.04.1. It may work on other ubuntus,
> debian and other debian-based systems using lsb-base (>= 3.0-6).
Are you joking? Which "standard"? You say standards-compliant, then
say it only works on Debian?
> Part of the standards-compliance is that the script issues no messages at
> boot or shutdown if /etc/default/rcS has VERBOSE=no (the default value).
Where is this requirement mentioned? I don't see it in
http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/tocsysinit.html
byt may have missed something.
Greets,
Volker
--
Volker Kuhlmann is list0570 with the domain in header
http://volker.dnsalias.net/ Please do not CC list postings to me.
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] fancontrol init script for ubuntu +
2009-01-21 6:30 [lm-sensors] fancontrol init script for ubuntu + Charles
2009-01-23 19:59 ` Mark Nienberg
2009-01-25 1:50 ` Volker Kuhlmann
@ 2009-01-25 2:01 ` Volker Kuhlmann
2 siblings, 0 replies; 4+ messages in thread
From: Volker Kuhlmann @ 2009-01-25 2:01 UTC (permalink / raw)
To: lm-sensors
On Sat 24 Jan 2009 08:59:40 NZDT +1300, Mark Nienberg wrote:
> Does anyone have a similar init script for fancontrol on redhat/centos/fedora?
Yes there is. /etc/init.d/lm_sensors on openSUSE loads the necessary
modules, and also starts the fancontrol script if /etc/fancontrol (the
fancontrol config file) exists. The script may not run directly on
redhat, but if you transplant the few lines of code into
/etc/init.d/skeleton.compat it will run on any chkconfig system.
The files are in these packages:
/etc/init.d/lm_sensors sensors
/etc/init.d/skeleton.compat aaa_base
Available from download.opensuse.org.
You can replace /usr/sbin/fancontrol with any script of your choice
(there are several on offer).
HTH,
Volker
--
Volker Kuhlmann is list0570 with the domain in header
http://volker.dnsalias.net/ Please do not CC list postings to me.
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-25 2:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 6:30 [lm-sensors] fancontrol init script for ubuntu + Charles
2009-01-23 19:59 ` Mark Nienberg
2009-01-25 1:50 ` Volker Kuhlmann
2009-01-25 2:01 ` Volker Kuhlmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.