#!/bin/sh
#
# $NetBSD: bitcoind.sh,v 1.3 2021/11/22 21:32:05 khorben Exp $
#
# Startup script for bitcoind
#
# PROVIDE: bitcoind
# REQUIRE: DAEMON
# KEYWORD: shutdown

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

name="bitcoind"
rcvar=$name
command="/usr/pkg/bin/bitcoind"
pidfile="/var/run/bitcoind.pid"
required_directory="/var/bitcoin"
command_args="-daemon -conf=/usr/pkg/etc/bitcoin.conf -pid=${pidfile} -datadir=${required_directory}"

if [ -f /etc/rc.subr ]; then
	load_rc_config $name
	run_rc_command "$1"
else
	echo -n " ${name}"
	${command} ${bitcoin_flags} ${command_args}
fi
