saslauthd :NAME Command not found

Discussion in 'Installation/Configuration' started by daashag, Jan 18, 2006.

  1. daashag

    daashag New Member

    Hi, I am following the perfect setup for Debian Sarge 3.1, I have run into a snag with saslauthd starting. I get the following error when I run the command /etc/init.d/saslauthd start

    /etc/init.d/saslauthd: line 1: NAME: command not found

    I saw a similar post from tecky. I checked what was suggested as a fix ie.. chmod +x. Also I am editing the files directly on my Debain install. I actully tried replacing the variable $NAME with saslauthd throughout the script. I still get the error with NAME variable completely removed from /etc/init.d/saslauthd script. I pretty much hit a brickwall on this one. Any help would be greatly appreciated.

    Thanks in advance

    dasshag
     
  2. till

    till Super Moderator

    Please post the contents of the file /etc/init.d/saslauthd and the output of the command: ls -la /etc/init.d/saslauthd
     
  3. daashag

    daashag New Member

    Thankyou for your response till.

    Here's the contents of my /etc/init.d/saslauthd file:

    #!/bin/sh -e

    NAME=saslauthd
    DAEMON="/usr/sbin/${NAME}"
    DESC="SASL Authentication Daemon"
    DEFAULTS=/etc/default/saslauthd
    PWDIR="/var/spool/postfix/var/run/$(NAME)"
    PIDFILE="$(PWDIR)/saslauthd.pid"
    dir="root sasl 755 $(PWDIR)"

    createdir() {
    # $1 = user
    # $2 = group
    # $3 = permissions (octal)
    # $4 = path to directory
    [ -d "$4" ] || mkdir -p "$4"
    chown -c -h "$1:$2" "$4"
    chmod -c "$3" "$4"
    }

    test -f "${DAEMON}" || exit 0

    # Source defaults file; edit that file to configure this script.
    if [ -e "${DEFAULTS}" ]; then
    . "${DEFAULTS}"
    fi

    # If we're not to start the daemon, simply exit
    if [ "${START}" != "yes" ]; then
    exit 0
    fi

    # If we have no mechanisms defined
    if [ "x${MECHANISMS}" = "x" ]; then
    echo "You need to configure ${DEFAULTS} with mechanisms to be used"
    exit 0
    fi

    # Add our mechanimsms with the necessary flag
    PARAMS="${PARAMS} -a ${MECHANISMS}"

    START="--start --quiet --pidfile ${PIDFILE} --startas ${DAEMON} --name ${NAME} -- ${PARAMS}"

    # Consider our options
    case "${1}" in
    start)
    echo -n "Starting ${DESC}: "
    #dir=`dpkg-statoverride --list $PWDIR`
    test -z "$dir" || createdir $dir
    if start-stop-daemon ${START} >/dev/null 2>&1 ; then
    echo "${NAME}."
    else
    if start-stop-daemon --test ${START} >/dev/null 2>&1; then
    echo "(failed)."
    exit 1
    else
    echo "${DAEMON} already running."
    exit 0
    fi
    fi
    ;;
    stop)
    echo -n "Stopping ${DESC}: "
    if start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" \
    --startas ${DAEMON} --retry 10 --name ${NAME} \
    >/dev/null 2>&1 ; then
    echo "${NAME}."
    else
    if start-stop-daemon --test ${START} >/dev/null 2>&1; then
    echo "(not running)."
    exit 0
    else
    echo "(failed)."
    exit 1
    fi
    fi
    ;;
    restart|force-reload)
    $0 stop
    exec $0 start
    ;;
    *)
    echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
    esac

    exit 0


    Heres the result of ls -la
    -rwxr-xr-x 1 root root 1959 2006-01-18 14:19 /etc/init.d/saslauthd

    Thansk again
     
  4. falko

    falko Super Moderator

    Ok, and you're sure that the file has Unix linebreaks, not Windows linebreaks?
     
  5. daashag

    daashag New Member

    Thanks for your response Falko

    I am using nano for my editor. Just for a shot in the dark I tried editing it with vi.

    I don't understand exactly what it is looking for. As I mentions in the original post, I substituted $(NAME) with "saslauthd". So the $(NAME) variable was completely removed from the script. And I still get the same error. Also line 1 of my /etc/init.d/saslauthd is the !bin/bash line. It acts like its not even running the script. I have also tried rebooting.

    Thanks again
     
  6. falko

    falko Super Moderator

    But maybe you created the file on a Windows system and then transferred it to your Linux system where you now use nano and vi to edit it. Therefore there could still be Windows linebreaks in the file. If lines end with something like
    ^M then there are Windows linebreaks.

    But in your previous post the first line was
    Code:
    #!/bin/sh -e
    , not
    Code:
    #!/bin/bash
    ...
     
  7. daashag

    daashag New Member

    Yeah your right, I just wrote that from memory, not the actual code. Although the actual /etc/init.d/saslauthd file has the correct code. I still don't understand the error. And why its calling line 1 of the /etc/init.d/saslauthd file. I think I want to start from scratch or at least the saslauthd part. I am a little concerned because this is a production box that I don't have physical access to, otherwise I would just reinstall and start over. I did a perfect setup on my laptop last night that has ubuntu and all went fine and the only differance in the installs was that I did a cut and paste instead of typing all the commands in. Any thoughts?

    Thanks daashag
     
  8. falko

    falko Super Moderator

    What if you simply re-create /etc/init.d/saslauthd with the code from http://www.howtoforge.com/perfect_setup_debian_sarge_p4 ?
    Use PuTTY for it, run
    Code:
    rm -f /etc/init.d/saslauthd
    vi /etc/init.d/saslauthd
    Then paste the code from the tutorial into the file, and then run
    Code:
    chmod 755 /etc/init.d/saslauthd
    /etc/init.d/saslauthd restart
     
  9. daashag

    daashag New Member

    Copy and Paste did the trick.

    Thanks for your help Falko.
     

Share This Page