diff options
author | Stuart Cardall <developer@it-offshore.co.uk> | 2017-03-13 05:31:23 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@alpinelinux.org> | 2017-03-17 09:51:55 +0000 |
commit | 3597bb4ea3f53255b366bec278b266dee2827fa4 (patch) | |
tree | 300cc6ae676196e5f1a4de64dc36df73aa28b2a1 /community/bitcoin/bitcoin.initd | |
parent | 202c1da50d05709af2b26dcb63bb433f562950fb (diff) | |
download | aports-3597bb4ea3f53255b366bec278b266dee2827fa4.tar.bz2 aports-3597bb4ea3f53255b366bec278b266dee2827fa4.tar.xz |
community/bitcoin: update to 0.14.0 / use supervise-daemon
https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.14.0.md
initd now uses supervise-daemon for service supervision.
please note the new bitcoin.conf format => do NOT enable daemon mode
as supervise-daemon requires services to run in the foreground.
Diffstat (limited to 'community/bitcoin/bitcoin.initd')
-rw-r--r-- | community/bitcoin/bitcoin.initd | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/community/bitcoin/bitcoin.initd b/community/bitcoin/bitcoin.initd index 6660605adb..a9c63fffde 100644 --- a/community/bitcoin/bitcoin.initd +++ b/community/bitcoin/bitcoin.initd @@ -1,38 +1,35 @@ #!/sbin/openrc-run +supervisor=supervise-daemon -# Bitcoin init.d file for Alpine Linux. - +description="Bitcoin daemon" name=bitcoind -daemon=/usr/bin/$name +command=/usr/bin/$name config=/etc/bitcoin.conf user=bitcoin group=bitcoin -## supercedes datadir set in $config ## datadir=/var/lib/bitcoin -pidfile=/run/bitcoin/$name.pid +pidfile="/run/bitcoin/$SVCNAME.sd.pid" +command_args="-server -conf=$config -datadir=$datadir -pid=$pidfile" +supervise_daemon_args="-u $user -g $group" +nice="-19" depend() { - need net - after logger firewall + use net + after logger firewall } -start() { - ebegin "Starting ${name}" - # enforce permissions - checkpath -q -d ${pidfile%/*} -o ${user}:${group} - checkpath -q -d ${datadir} -m 0700 -o ${user}:${group} - checkpath -q -f ${config} -m 0600 -o ${user}:${group} - start-stop-daemon --start --quiet \ - --pidfile ${pidfile} \ - --user ${user}:${group} \ - --exec ${daemon} -- -conf=${config} -datadir=${datadir} -pid=${pidfile} - eend $? +in_contr() { + grep "container=" /proc/1/environ } -stop() { - ebegin "Stopping ${name}" - start-stop-daemon --stop --quiet \ - --pidfile ${pidfile} \ - --exec ${daemon} - eend $? +start_pre() { + # enforce permissions + checkpath -q -d ${pidfile%/*} -o ${user}:${group} + checkpath -q -d ${datadir} -m 0700 -o ${user}:${group} + checkpath -q -f ${config} -m 0600 -o ${user}:${group} + + # in lxc sys_nice capability is dropped by default + if [ -z "$(in_contr)" ]; then + supervise_daemon_args="$supervise_daemon_args -N $nice" + fi } |