aboutsummaryrefslogblamecommitdiffstats
path: root/community/bitcoin/bitcoin.initd
blob: a9c63fffde7d5cc8a1125752a9aafd94c064f00b (plain) (tree)
1
2
3
4
5
6
7
8
9
                  
                           
 
                            
             
                      


                        
                        



                                                                    

          

                             

 

                                         

 









                                                                       
 
#!/sbin/openrc-run
supervisor=supervise-daemon

description="Bitcoin daemon"
name=bitcoind
command=/usr/bin/$name
config=/etc/bitcoin.conf
user=bitcoin
group=bitcoin
datadir=/var/lib/bitcoin
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() {
	use net
	after logger firewall
}

in_contr() {
	grep "container=" /proc/1/environ
}

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
}