0

Trying to start bitcoind on CentOS 6, but just getting command not found errors.

#!/bin/bash
#
#  bitcoind The bitcoin core server.
#
#
# chkconfig: 345 80 20
# description: bitcoind
# processname: bitcoind
#

# Source function library.
. /etc/init.d/functions

prog=bitcoind
lockfile=/var/lock/subsys/bitcoind

start() {
    echo -n $"Starting $prog: "
    daemon --user bitcoind LD_LIBRARY_PATH=/home/bitcoind/bitcoind/deps/lib /home/bitcoind/bitcoind/downloads/bitcoin-0.9.4/src/bitcoind
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $lockfile
    return $RETVAL
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f $lockfile
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $prog
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: service $prog {start|stop|status|restart}"
        exit 1
        ;;
esac

But then when I try to run it:

root@server1 [/etc/init.d]# service bitcoind start
Starting bitcoind: /etc/init.d/bitcoind: line 19:  : command not found
/etc/init.d/bitcoind: line 20:  : command not found

/etc/init.d/bitcoind: line 22: [: -eq: unary operator expected
root@server1 [/etc/init.d]#
  • 1
    Is there a good reason why you don't want to use the existing packages? – Michael Hampton Feb 14 '15 at 20:28
  • Ragarding . /etc/init.d/functions. Please add the function(s) that is/are used within the start() function. – 030 Feb 15 '15 at 12:11
1

Beneath the sourcing of functions, please add:

RETVAL=0

so that the lines look like:

# Source function library.
. /etc/init.d/functions
RETVAL=0

If you take a look into many of CentOS init scripts, majority of them has RETVAL=0 initialized.

% grep RETVAL=0 /etc/init.d/*
acpid:RETVAL=0
atop:RETVAL=0
auditd:RETVAL=0
autofs:     RETVAL=0
...
sshd:RETVAL=0
...
winbind:RETVAL=0
wine:RETVAL=0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.