#!/bin/sh # PROVIDE: novacoin # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # novacoin_enable (bool): Set to NO by default. Set this variable to YES if you want to enable novacoin service. # novacoin_config (path): Set to /usr/local/etc/novacoin.conf by default. # novacoin_user: The user account novacoin daemon runs as. It uses 'root' user by default. # novacoin_group: The group account novacoin daemon runs as. It uses 'wheel' group by default. # novacoin_datadir (str): Default to "/var/db/novacoin". Base data directory. . /etc/rc.subr name=novacoin rcvar=novacoin_enable : ${novacoin_enable:=NO} : ${novacoin_config=/usr/local/etc/novacoin.conf} : ${novacoin_datadir=/var/db/novacoin} : ${novacoin_user="root"} : ${novacoin_group="wheel"} required_files=${novacoin_config} command=/usr/local/bin/novacoind novacoin_chdir=${novacoin_datadir} pidfile="${novacoin_datadir}/novacoind.pid" stop_cmd=novacoin_stop command_args="-conf=${novacoin_config} -datadir=${novacoin_datadir} -daemon -pid=${pidfile}" start_precmd="${name}_prestart" novacoin_create_datadir() { echo "Creating data directory" eval mkdir -p ${novacoin_datadir} [ $? -eq 0 ] && chown -R ${novacoin_user}:${novacoin_group} ${novacoin_datadir} } novacoin_prestart() { if [ ! -d "${novacoin_datadir}/." ]; then novacoin_create_datadir || return 1 fi } novacoin_requirepidfile() { if [ ! "0`check_pidfile ${pidfile} ${command}`" -gt 1 ]; then echo "${name} not running? (check $pidfile)." exit 1 fi } novacoin_stop() { novacoin_requirepidfile echo "Stopping ${name}." eval ${command} -conf=${novacoin_config} -datadir=${novacoin_datadir} stop wait_for_pids ${rc_pid} } load_rc_config $name run_rc_command "$1"