Merge #11326: Fix crash on shutdown with invalid wallet
[bitcoinplatinum.git] / contrib / init / bitcoind.init
blobdb5061874b3a923278fa11d4f3117fca19da1bcc
1 #!/bin/bash
3 # bitcoind The bitcoin core server.
6 # chkconfig: 345 80 20
7 # description: bitcoind
8 # processname: bitcoind
11 # Source function library.
12 . /etc/init.d/functions
14 # you can override defaults in /etc/sysconfig/bitcoind, see below
15 if [ -f /etc/sysconfig/bitcoind ]; then
16 . /etc/sysconfig/bitcoind
19 RETVAL=0
21 prog=bitcoind
22 # you can override the lockfile via BITCOIND_LOCKFILE in /etc/sysconfig/bitcoind
23 lockfile=${BITCOIND_LOCKFILE-/var/lock/subsys/bitcoind}
25 # bitcoind defaults to /usr/bin/bitcoind, override with BITCOIND_BIN
26 bitcoind=${BITCOIND_BIN-/usr/bin/bitcoind}
28 # bitcoind opts default to -disablewallet, override with BITCOIND_OPTS
29 bitcoind_opts=${BITCOIND_OPTS--disablewallet}
31 start() {
32 echo -n $"Starting $prog: "
33 daemon $DAEMONOPTS $bitcoind $bitcoind_opts
34 RETVAL=$?
35 echo
36 [ $RETVAL -eq 0 ] && touch $lockfile
37 return $RETVAL
40 stop() {
41 echo -n $"Stopping $prog: "
42 killproc $prog
43 RETVAL=$?
44 echo
45 [ $RETVAL -eq 0 ] && rm -f $lockfile
46 return $RETVAL
49 case "$1" in
50 start)
51 start
53 stop)
54 stop
56 status)
57 status $prog
59 restart)
60 stop
61 start
64 echo "Usage: service $prog {start|stop|status|restart}"
65 exit 1
67 esac