Update FreeBSD bitcoind service script

This commit is contained in:
wiz 2020-10-23 22:11:32 +09:00
parent 5eeb567527
commit 4abdfe12c6
No known key found for this signature in database
GPG Key ID: A394E332255A6173
2 changed files with 21 additions and 9 deletions

View File

@ -1,6 +1,4 @@
#!/bin/sh #!/bin/sh
# $FreeBSD: branches/2020Q2/net-p2p/bitcoin/files/bitcoind.in 488524 2018-12-27 09:53:37Z ale $
# PROVIDE: bitcoind # PROVIDE: bitcoind
# REQUIRE: LOGIN cleanvar # REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown # KEYWORD: shutdown
@ -11,8 +9,10 @@
# Set it to "YES" to enable bitcoind # Set it to "YES" to enable bitcoind
# bitcoind_user (str) Set to "bitcoin" by default. # bitcoind_user (str) Set to "bitcoin" by default.
# bitcoind_group (str) Set to "bitcoin" by default. # bitcoind_group (str) Set to "bitcoin" by default.
# bitcoind_conf (str) Set to "/usr/local/etc/bitcoind.conf" by default. # bitcoind_conf (str) Set to "/bitcoin/bitcoind.conf" by default.
# bitcoind_data_dir (str) Set to "/var/db/bitcoin" by default. # bitcoind_data_dir (str) Set to "/var/db/bitcoin" by default.
# bitcoind_syslog_facility(str) Set to "local0" by default.
# bitcoind_syslog_priority(str) Set to "info" by default.
# bitcoindlimits_enable (bool) Set to "NO" by default. # bitcoindlimits_enable (bool) Set to "NO" by default.
# Set it to "YES" to enable bitcoindlimits # Set it to "YES" to enable bitcoindlimits
# bitcoindlimits_args Set to "-e -U ${bitcoind_user}" by default # bitcoindlimits_args Set to "-e -U ${bitcoind_user}" by default
@ -33,7 +33,7 @@ stop_cmd="bitcoind_stop"
stop_postcmd="bitcoind_wait" stop_postcmd="bitcoind_wait"
command="/usr/local/bin/bitcoind" command="/usr/local/bin/bitcoind"
daemon_command="/usr/sbin/daemon" daemon_command="/usr/sbin/daemon"
pidfile="/var/run/${name}.pid" pidfile="/bitcoin/bitcoind.pid"
extra_commands="configtest" extra_commands="configtest"
@ -44,13 +44,17 @@ load_rc_config ${name}
: ${bitcoind_user:="bitcoin"} : ${bitcoind_user:="bitcoin"}
: ${bitcoind_group:="bitcoin"} : ${bitcoind_group:="bitcoin"}
: ${bitcoind_data_dir:="/var/db/bitcoin"} : ${bitcoind_data_dir:="/bitcoin"}
: ${bitcoind_config_file:="/usr/local/etc/bitcoin.conf"} : ${bitcoind_config_file:="/bitcoin/bitcoin.conf"}
: ${bitcoind_syslog_facility:="local0"}
: ${bitcoind_syslog_priority:="info"}
: ${bitcoind_syslog_tag:="bitcoind"}
: ${bitcoind_kill_after:="300"}
: ${bitcoindlimits_args:="-e -U ${bitcoind_user}"} : ${bitcoindlimits_args:="-e -U ${bitcoind_user}"}
# set up dependant variables # set up dependant variables
procname="${command}" procname="${command}"
#pidfile="${bitcoind_data_dir}/bitcoind.pid" pidfile="${bitcoind_data_dir}/bitcoind.pid"
required_files="${bitcoind_config_file}" required_files="${bitcoind_config_file}"
@ -118,8 +122,13 @@ bitcoind_start()
{ {
echo "Starting bitcoind:" echo "Starting bitcoind:"
cd "${bitcoind_data_dir}" || return 1 cd "${bitcoind_data_dir}" || return 1
${daemon_command} -u "${bitcoind_user}" -p "${pidfile}" -f \ ${daemon_command} \
-u "${bitcoind_user}" \
-l "${bitcoind_syslog_facility}" \
-s "${bitcoind_syslog_priority}" \
-T "${bitcoind_syslog_tag}" \
${command} \ ${command} \
-printtoconsole=1 \
-conf="${bitcoind_config_file}" \ -conf="${bitcoind_config_file}" \
-datadir="${bitcoind_data_dir}" -datadir="${bitcoind_data_dir}"
} }
@ -139,7 +148,7 @@ bitcoind_stop()
bitcoind_wait() bitcoind_wait()
{ {
local n=60 local n="${bitcoind_kill_after}"
echo "Waiting for bitcoind shutdown:" echo "Waiting for bitcoind shutdown:"
while : while :
do do

View File

@ -0,0 +1,3 @@
local0.info /var/log/bitcoind.mainnet
local1.info /var/log/bitcoind.testnet
local2.info /var/log/elementsd.liquid