# Where to define rc.d variable?



## Floren (Jan 20, 2021)

I have the following rc.d file installed by sonarr pkg:

```
# cat /usr/local/etc/rc.d/sonarr
#!/bin/sh
#
# Author: Mark Felder <feld@FreeBSD.org>
#
# $FreeBSD: head/net-p2p/sonarr/files/sonarr.in 454856 2017-11-24 23:17:50Z dbaio $
#

# PROVIDE: sonarr
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable sonarr:
# sonarr_enable="YES"

. /etc/rc.subr

name="sonarr"
rcvar=sonarr_enable

load_rc_config $name

: ${sonarr_enable="NO"}
: ${sonarr_user:="sonarr"}
: ${sonarr_data_dir:="/usr/local/sonarr"}

pidfile="${sonarr_data_dir}/nzbdrone.pid"
procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} /usr/local/share/sonarr/NzbDrone.exe --nobrowser --data=${sonarr_data_dir}"
start_precmd=sonarr_precmd

sonarr_precmd()
{
    export XDG_CONFIG_HOME=${sonarr_data_dir}

    if [ ! -d ${sonarr_data_dir} ]; then
        install -d -o ${sonarr_user} ${sonarr_data_dir}
    fi
}

run_rc_command "$1"
```

In what .d directory I can define a new value for sonarr_user variable? I do not want to edit the rc.d file.


----------



## SirDice (Jan 20, 2021)

It should go in rc.conf, just as the other variables (`sonarr_enable`).



Floren said:


> I do not want to edit the rc.d file.


Never edit those files.


----------



## Floren (Jan 20, 2021)

Thank you, for other newbies like myself, you can set it with `sysrc sonarr_user=alpha`.


----------

