Re: User specific daemons

From: Dan Mahoney <freebsd_at_gushi.org>
Date: Tue, 23 Jan 2024 00:10:21 UTC

> On Jan 22, 2024, at 15:51, Robert R. Russell <robert@rrbrussell.com> wrote:
> 
> How do I start and maintain a program as a user specific daemon? I
> don't mean run a daemon as a specific user. I need one of each daemon
> per user.
> 
> Under Linux I could create a few $HOME/.config/systemd/daemon.service
> files run systemctl --user enable daemon.service and the problem was
> solved. The services specifically include tmux, and ssh-agent or
> gpg-agent. There were some other services I used this for but those were
> more Linux specific and thus less important.
> 
> Before I go with the metaphorical hammer meets nail shaped object
> approach and port half of SystemD to FreeBSD using Rust what options
> should I try first.

I would do this with an @reboot cron job, which stepped over a list of users (you don't want *all* users, you want all the users in some group), and then fired those processes up.

If you really need those processes to restart, wrapper them with daemon(1).

-Dan