How to start an installed package on boot

Starting with freeBSD, I think a new hobby started, still a lot to learn.

I installed the package bsdFan, https://www.freshports.org/sysutils/bsdfan.
This package does not start on boot so I would like to know how to achieve that.

I tried to add the following to rc.conf:
Code:
bsdfan_enabled="YES"
But this does not load that package.

The package is installed here:

Code:
/usr/ports/sysutils/bsdfan
/usr/local/bin/bsdfan

What is the proper way to have this start on boot or user login.

Thanks,
 
I tried to add the following to rc.conf:
Code:
bsdfan_enabled="YES"
That can't work. Package sysutils/bsdfan doesn't provide a rc(8) script which could be started from /etc/rc.conf. You need to write one yourself. Don't worry, it's easy, see rc(8), 'EXAMPLES' section. Replace 'foo' with 'bsdfan'.

bsdfan(1) can run also as a daemon. Take /etc/rc.d/powerd as draft, except the stop_postcmd=powerd_poststop part.
In addition set under 'command' following lines:
Code:
bsdfan_flags="-d"

: ${bsdfan_enable:=NO}

Place the script under /usr/local/etc/rc.d, and chmod 555 bsdfan (bsdfan here name of the rc script), change the rc.conf line as D-FENS advised, start service as root: service bsdfan start.
 
charly welcome to FreeBSD Forums.

… user login. …

Will you use a desktop environment?

A shot of KDE Plasma:

1645975902301.png
 
Many thanks for this.
I was trying the same, but always had a error when starting the service:

WARNING: $bsdfan is not set properly - see rc.conf(5). Cannot 'start' bsdfan. Set bsdfan to YES in /etc/rc.conf or use 'onestart' instead of 'start'.
This was my script:

#!/bin/sh # # PROVIDE: bsdfan # REQUIRE: bar_service_required_to_precede_bsdfan . /etc/rc.subr name="bsdfan" rcvar="bsdfan" command="/usr/local/bin/bsdfan" bsdfan_flags="-d" : ${bsdfan_enable:=NO} load_rc_config $name run_rc_command "$1"


The problem was this:
rcvar="bsdfan"

Correct:
rcvar="bsdfan_enable"


Just want to share this as a hint if any other BSD Newby runs into this issue.

Thanks all.
 
Back
Top