Merge pull request #5847
723664b
startup script for centos, with documentation. (joshr)
This commit is contained in:
commit
f238add26a
@ -4,6 +4,7 @@ SystemD: bitcoind.service
|
|||||||
Upstart: bitcoind.conf
|
Upstart: bitcoind.conf
|
||||||
OpenRC: bitcoind.openrc
|
OpenRC: bitcoind.openrc
|
||||||
bitcoind.openrcconf
|
bitcoind.openrcconf
|
||||||
|
CentOS: bitcoind.init
|
||||||
|
|
||||||
have been made available to assist packagers in creating node packages here.
|
have been made available to assist packagers in creating node packages here.
|
||||||
|
|
||||||
|
67
contrib/init/bitcoind.init
Normal file
67
contrib/init/bitcoind.init
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# bitcoind The bitcoin core server.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# chkconfig: 345 80 20
|
||||||
|
# description: bitcoind
|
||||||
|
# processname: bitcoind
|
||||||
|
#
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
# you can override defaults in /etc/sysconfig/bitcoind, see below
|
||||||
|
if [ -f /etc/sysconfig/bitcoind ]; then
|
||||||
|
. /etc/sysconfig/bitcoind
|
||||||
|
fi
|
||||||
|
|
||||||
|
RETVAL=0
|
||||||
|
|
||||||
|
prog=bitcoind
|
||||||
|
# you can override the lockfile via BITCOIND_LOCKFILE in /etc/sysconfig/bitcoind
|
||||||
|
lockfile=${BITCOIND_LOCKFILE-/var/lock/subsys/bitcoind}
|
||||||
|
|
||||||
|
# bitcoind defaults to /usr/bin/bitcoind, override with BITCOIND_BIN
|
||||||
|
bitcoind=${BITCOIND_BIN-/usr/bin/bitcoind}
|
||||||
|
|
||||||
|
# bitcoind opts default to -disablewallet, override with BITCOIND_OPTS
|
||||||
|
bitcoind_opts=${BITCOIND_OPTS--disablewallet}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
echo -n $"Starting $prog: "
|
||||||
|
daemon $DAEMONOPTS $bitcoind $bitcoind_opts
|
||||||
|
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
|
12
doc/init.md
12
doc/init.md
@ -8,6 +8,7 @@ can be found in the contrib/init folder.
|
|||||||
contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script
|
contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script
|
||||||
contrib/init/bitcoind.openrcconf: OpenRC conf.d file
|
contrib/init/bitcoind.openrcconf: OpenRC conf.d file
|
||||||
contrib/init/bitcoind.conf: Upstart service configuration file
|
contrib/init/bitcoind.conf: Upstart service configuration file
|
||||||
|
contrib/init/bitcoind.init: CentOS compatible SysV style init script
|
||||||
|
|
||||||
1. Service User
|
1. Service User
|
||||||
---------------------------------
|
---------------------------------
|
||||||
@ -49,6 +50,7 @@ Configuration file: /etc/bitcoin/bitcoin.conf
|
|||||||
Data directory: /var/lib/bitcoind
|
Data directory: /var/lib/bitcoind
|
||||||
PID file: /var/run/bitcoind/bitcoind.pid (OpenRC and Upstart)
|
PID file: /var/run/bitcoind/bitcoind.pid (OpenRC and Upstart)
|
||||||
/var/lib/bitcoind/bitcoind.pid (systemd)
|
/var/lib/bitcoind/bitcoind.pid (systemd)
|
||||||
|
Lock file: /var/lock/subsys/bitcoind (CentOS)
|
||||||
|
|
||||||
The configuration file, PID directory (if applicable) and data directory
|
The configuration file, PID directory (if applicable) and data directory
|
||||||
should all be owned by the bitcoin user and group. It is advised for security
|
should all be owned by the bitcoin user and group. It is advised for security
|
||||||
@ -81,7 +83,15 @@ Drop bitcoind.conf in /etc/init. Test by running "service bitcoind start"
|
|||||||
it will automatically start on reboot.
|
it will automatically start on reboot.
|
||||||
|
|
||||||
NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they
|
NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they
|
||||||
use old versions of Upstart and do not supply the start-stop-daemon uitility.
|
use old versions of Upstart and do not supply the start-stop-daemon utility.
|
||||||
|
|
||||||
|
4d) CentOS
|
||||||
|
|
||||||
|
Copy bitcoind.init to /etc/init.d/bitcoind. Test by running "service bitcoind start".
|
||||||
|
|
||||||
|
Using this script, you can adjust the path and flags to the bitcoind program by
|
||||||
|
setting the BITCOIND and FLAGS environment variables in the file
|
||||||
|
/etc/sysconfig/bitcoind. You can also use the DAEMONOPTS environment variable here.
|
||||||
|
|
||||||
5. Auto-respawn
|
5. Auto-respawn
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user