Creating the daemonCreate the file /etc/rc.d/fossil with contents like the following.
#!/bin/ksh daemon="/usr/local/bin/fossil" # fossil executable daemon_user="_fossil" # user to run fossil as daemon_flags="server /home/_fossil/example --repolist --port 8888" # fossil command
. /etc/rc.d/rc.subr # pexp="$daemon server .*" # See below. rc_bg=YES # Run in the background, since fossil serve does not daemonize itself rc_cmd $1
pexpYou may need to uncomment the "pexp=". rc.subr typically finds the daemon process based by matching the process name and argument list. Without the "pexp=" line, rc.subr would look for this exact command:
/usr/local/bin/fossil server /home/_fossil/example --repolist --port 8888
Depending on the arguments and their order, fossil may rewrite the arguments for display in the process listing (ps(1)), so rc.subr may fail to find the process through the default match. The example above does not get rewritten, but the same commands in a different order can be rewritten. For example, when I switch the order of the arguments in "daemon_flags",
/usr/local/bin/fossil server --repolist --port 8888 /home/_fossil/example
the process command is changed to this.
/usr/local/bin/fossil server /home/_fossil/example /home/_fossil/example 8888 /home/_fossil/example
The commented "pexp=" line instructs rc.subr to choose the process whose command and arguments text starts with this:
Enabling the daemonOnce you have created /etc/rc.d/fossil, run these commands.
rcctl enable fossil # add fossil to pkg_scripts in /etc/rc.conf.local rcctl start fossil # start the daemon now
The daemon should now be running and set to start at boot.
Multiple daemonsYou may want to serve multiple fossil instances with different options. For example,
- If different users own different repositories, you may want different users to serve different repositories.
- You may want to serve different repositories on different ports so you can control them differently with, for example, HTTP reverse proxies or pf(4).
To run multiple fossil daem