I'm a ham radio operator, trying to get the Morse-code program cwdaemon to run at startup. There is an /etc/init.d entry "cwdaemon," and here it is:
************************************************** *****
#! /bin/sh
### BEGIN INIT INFO
# Provides: cwdaemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: A Morse daemon.
### END INIT INFO
#
# Author of this script: Ladislav Vaiz <ok1zia@nagano.cz>
#
# Version: @(#)cwdaemon 1.0 03-Jul-2004 ok1zia@nagano.cz
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/cwdaemon
NAME=cwdaemon
DESC="Morse daemon"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
OPTS=""
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Exit if it says no start
grep -q '^START_CWDAEMON=yes' /etc/default/$NAME || exit 0
# Read config file if it is present.
if [ -r /etc/default/$NAME ]
then
. /etc/default/$NAME
test -n "$DEVICE" && OPTS="$OPTS -d $DEVICE"
test -n "$UDPPORT" && OPTS="$OPTS -p $UDPPORT"
test -n "$PRIORITY" && OPTS="$OPTS -P $PRIORITY"
test -n "$SPEED" && OPTS="$OPTS -s $SPEED"
test -n "$PTTDELAY" && OPTS="$OPTS -t $PTTDELAY"
test -n "$VOLUME" && OPTS="$OPTS -v $VOLUME"
test -n "$WEIGHT" && OPTS="$OPTS -w $WEIGHT"
test -n "$SDEVICE" && OPTS="$OPTS -x $SDEVICE"
fi
case "$1" in
start)
echo "$DEVICE" | grep -q 'parport'
if [ $? = 0 ]; then
lsmod|grep -q '\<lp\>'
if [ $? = 0 ]; then
echo "Removing module lp"
rmmod lp
fi
fi
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --exec $DAEMON -- $OPTS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --exec $DAEMON
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --exec $DAEMON -- $OPTS
echo "."
;;
status)
/bin/ps xa|grep "$DAEMON" | grep -v "grep"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
*******************************************
and here is /etc/default/cwdaemon:
****************************************
# /etc/default/cwdaemon
# OK1ZIA 17 Aug 2004
#
# Start cwdaemon at boot? yes or no
START_CWDAEMON=yes
# device without /dev/ e.g. ttyS0, ttyS1, ttyUSB0, ttyd0 (FreeBSD), parport0,
# parport1, ... or null for no port keying.
# Default for linux: parport0 with ppdev driver
DEVICE="parport0"
# default 6789
UDPPORT="6789"
# priority -20 to +20
PRIORITY="0"
# CW speed in WPM. Default 24
SPEED="35"
# default 0
PTTDELAY="0"
# volume for soundcard. 0 to 100, default 70
VOLUME="80"
# weight -50 to 50. Default 0
WEIGHT="0"
# sound device:
# c: console, s: soundcard, b: both, n: none. Default is c.
SDEVICE="b"
********************************************
Running ps -A immediately after booting up shows cwdaemon is not running. I can start it with a sudo /usr/sbin and ./cwdaemon. Some of my amateur-radio friends have identical /etc/default/cwdaemon and /etc/init.d/cwdaemon files, and their cwdaemon starts at boot. Does this information allow anyone to see why mine doesn't? (My BIOS allows parallel-port functioning, parport0 is OK, and the lp module is not loaded; these are things the cwdaemon README suggested checking.)
************************************************** *****
#! /bin/sh
### BEGIN INIT INFO
# Provides: cwdaemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: A Morse daemon.
### END INIT INFO
#
# Author of this script: Ladislav Vaiz <ok1zia@nagano.cz>
#
# Version: @(#)cwdaemon 1.0 03-Jul-2004 ok1zia@nagano.cz
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/cwdaemon
NAME=cwdaemon
DESC="Morse daemon"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
OPTS=""
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Exit if it says no start
grep -q '^START_CWDAEMON=yes' /etc/default/$NAME || exit 0
# Read config file if it is present.
if [ -r /etc/default/$NAME ]
then
. /etc/default/$NAME
test -n "$DEVICE" && OPTS="$OPTS -d $DEVICE"
test -n "$UDPPORT" && OPTS="$OPTS -p $UDPPORT"
test -n "$PRIORITY" && OPTS="$OPTS -P $PRIORITY"
test -n "$SPEED" && OPTS="$OPTS -s $SPEED"
test -n "$PTTDELAY" && OPTS="$OPTS -t $PTTDELAY"
test -n "$VOLUME" && OPTS="$OPTS -v $VOLUME"
test -n "$WEIGHT" && OPTS="$OPTS -w $WEIGHT"
test -n "$SDEVICE" && OPTS="$OPTS -x $SDEVICE"
fi
case "$1" in
start)
echo "$DEVICE" | grep -q 'parport'
if [ $? = 0 ]; then
lsmod|grep -q '\<lp\>'
if [ $? = 0 ]; then
echo "Removing module lp"
rmmod lp
fi
fi
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --exec $DAEMON -- $OPTS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --exec $DAEMON
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --exec $DAEMON -- $OPTS
echo "."
;;
status)
/bin/ps xa|grep "$DAEMON" | grep -v "grep"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
*******************************************
and here is /etc/default/cwdaemon:
****************************************
# /etc/default/cwdaemon
# OK1ZIA 17 Aug 2004
#
# Start cwdaemon at boot? yes or no
START_CWDAEMON=yes
# device without /dev/ e.g. ttyS0, ttyS1, ttyUSB0, ttyd0 (FreeBSD), parport0,
# parport1, ... or null for no port keying.
# Default for linux: parport0 with ppdev driver
DEVICE="parport0"
# default 6789
UDPPORT="6789"
# priority -20 to +20
PRIORITY="0"
# CW speed in WPM. Default 24
SPEED="35"
# default 0
PTTDELAY="0"
# volume for soundcard. 0 to 100, default 70
VOLUME="80"
# weight -50 to 50. Default 0
WEIGHT="0"
# sound device:
# c: console, s: soundcard, b: both, n: none. Default is c.
SDEVICE="b"
********************************************
Running ps -A immediately after booting up shows cwdaemon is not running. I can start it with a sudo /usr/sbin and ./cwdaemon. Some of my amateur-radio friends have identical /etc/default/cwdaemon and /etc/init.d/cwdaemon files, and their cwdaemon starts at boot. Does this information allow anyone to see why mine doesn't? (My BIOS allows parallel-port functioning, parport0 is OK, and the lp module is not loaded; these are things the cwdaemon README suggested checking.)
Comment