#!/bin/sh

# $FreeBSD: head/net-p2p/xmrig/files/xmrig.in 461370 2018-02-10 09:35:49Z ehaupt $
#
# PROVIDE: xmrig
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# xmrig_enable (bool):	Set to NO by default.
#			Set it to YES to enable it.
# xmrig_user:		The user account the XMRig daemon runs as.
#			It uses 'xmrig' user by default.
#			Do not sets it as empty or it will run as root.
# xmrig_conf:		The configuration file XMRig uses.    
#			Default: /usr/local/etc/xmrig/config.json

. /etc/rc.subr
name="xmrig"
rcvar="${name}_enable"
load_rc_config ${name}

: ${xmrig_enable:="NO"}
: ${xmrig_user:="xmrig"}
: ${xmrig_conf:="/usr/local/etc/xmrig/config.json"}

command="/usr/sbin/daemon"
procname="/usr/local/bin/xmrig"
command_args="-f ${procname} --config=${xmrig_conf}"

run_rc_command "$1"
