diff options
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 } |