# How to start an installed package on boot



## charly (Feb 26, 2022)

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:

```
bsdfan_enabled="YES"
```
But this does not load that package.

The package is installed here:


```
/usr/ports/sysutils/bsdfan
/usr/local/bin/bsdfan
```

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

Thanks,


----------



## D-FENS (Feb 27, 2022)

Change `bsdfan_enabled="YES"` to `bsdfan_enable="YES"`.


----------



## T-Daemon (Feb 27, 2022)

charly said:


> I tried to add the following to rc.conf:
> 
> ```
> 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:

```
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`.


----------



## grahamperrin@ (Feb 27, 2022)

charly welcome to FreeBSD Forums. 



charly said:


> … user login. …



Will you use a desktop environment? 

A shot of KDE Plasma:


----------



## grahamperrin@ (Feb 27, 2022)

T-Daemon said:


> … change the rc.conf line as D-FENS advised, …



`sysrc -f /etc/rc.conf bsdfan_enable="YES"`



charly said:


> … a new hobby started, still a lot to learn. …



An opportunity to demonstrate use of sysrc(8) for safe edition of system rc files.


----------



## charly (Feb 27, 2022)

grahamperrin said:


> `sysrc -f /etc/rc.conf bsdfan_enable="YES"`
> 
> 
> 
> An opportunity to demonstrate use of sysrc(8) for safe edition of system rc files.


I would like to thank you both.
This is working great.


----------



## grahamperrin@ (Feb 28, 2022)

charly said:


> … working great.



Thanks for feedback, you can add the _Solved_ prefix to your topic.


----------

