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]#
Best Answer
Beneath the sourcing of functions, please add:
so that the lines look like:
If you take a look into many of CentOS init scripts, majority of them has RETVAL=0 initialized.