Announcement

Collapse
No announcement yet.

Why doesn't this start cwdaemon?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why doesn't this start cwdaemon?

    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.)
    -- Werdigo49
    Registered Linux User #291592
    Kubuntu Xenial Xerus (16.04)

    #2
    Check the README in /usr/share/cwdaemon for a description of the circuitry, usage and testing of cwdaemon.
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Originally posted by Snowhog View Post
      Check the README in /usr/share/cwdaemon for a description of the circuitry, usage and testing of cwdaemon.
      Thanks for responding, Snowhog. Maybe I should have reported that I'd already spent a lot of time in the README, etc. I posted here because friends using other OS's run cwdaemon successfully so I thought maybe it was an OS-specific problem.

      Following one suggestion, I ran this and got this result:

      user@user-machine:~$ sudo /etc/init.d/cwdaemon start
      [sudo] password for user:
      Removing module lp
      Starting Morse daemon: cwdaemonSegmentation fault (core dumped)]

      (One of my fellow users, running this, just gets "Starting Morse daemon: cwdaemon" in the last line.) I'm trying to track down the reason for the segfault.

      My apologies if this really doesn't have anything to do with Kubuntu. I'll be glad to stop posting on this topic if that's the case.
      -- Werdigo49
      Registered Linux User #291592
      Kubuntu Xenial Xerus (16.04)

      Comment


        #4
        Nope. We don't know for sure what is causing the problem for you.
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          What's the output of
          Code:
          ls -al /etc/rc*.d/*cwdaemon

          Comment


            #6
            Like Steve is suggesting, having an init script in /etc/init.d doesn't actually start it on boot, what you need to run it in are rc links pointing to the script in the run-level directories (/etc/rc?.d).

            The command Steve posted will let you know whether they exist.

            If not, you can add "default" links with the command:
            Code:
            sudo update-rc.d cwdaemon defaults 99 01

            Comment

            Working...
            X