Run fossil as service

I have been running fossil as my scm server this year and I’ll not be going back to git for anything other than disposable repos. It’s currently set up using inetd. I would like to move it to a stand-alone service. It’s just a single executable that needs to be run:
Code:
fossil server

It’s been a while since I set up a custom service in FreeBSD. What’s a lightweight approach to getting it to run at startup?

I’m trying out Truenas core so it’ll prolly wind up running in a jail.
 
SirDice I don't see /usr/local/etc/rc.d/fossil, but the point is well taken. Here's what I put together. It's working, but I'm not getting logging. I think it may be a fossil issue, so I'm asking about that over there. Does this look like I'm following freebsdisms?

install.sh
Bash:
#!/bin/sh

install -b -g wheel -m 0555 -o root -v rc-fossild /usr/local/etc/rc.d/fossild
touch /var/log/fossil.log
echo to enable the service:
echo 'sysrc -f /etc/rc.conf fossild_enable="YES"'
echo 'service fossild start'

rc-fossil
Bash:
#!/bin/sh
#
# PROVIDE: fossild
# REQUIRE:
# KEYWORD:

. /etc/rc.subr

name="fossild"
rcvar="fossild_enable"

fossild_command="/usr/local/bin/fossil server -P 8080 --repolist /zfs/fossils --errorlog /var/log/fossil.log"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -f ${fossild_command}"

load_rc_config $name

: ${fossild_enable:=no}

run_rc_command "$1"
 
The devel/fossil port/package installs a proper rc(8) script.
Sure enough. In my messing around with my own scripts, I borked the installed script. Life's better now:

Code:
pkg install fossil

vi /usr/local/etc/rc.d/fossil
# add support for fossil_errorlog variable to fossil_args
[ -n "${fossil_errorlog}"  ] && fossil_args="${fossil_args} --errorlog ${fossil_errorlog}"


sysrc fossil_enable="YES"
sysrc fossil_repolist="/zfs/fossils"
sysrc fossil_directory="/zfs/fossils"
sysrc fossil_listenall="YES"
sysrc fossil_errorlog="/zfs/fossils/fossil.log"
service fossil start

Browse to root of site - repo list works, browse to admin errolog of a repo it works!
 
Back
Top