Tag Archives: rc.d

Changing FreeBSD’s rcorder without patching

I was upgrading my jails, when I noticed that the WriteFreely instance for օրագիր.հայ was not running. I jexec’d into the jail and noticed that the writefreely process was not running at all, doing a simple service writefreely start made it work. Why?

Turns out that WriteFreely needs MySQL to be running during startup, and I assume it wasn’t. By running rcorder I was able to see the boot process.

# rcorder /usr/local/etc/rc.d/* 2>/dev/null
writefreely
rsyncd
mysql-server
garb

So, my first instinct was to patch the /usr/local/etc/rc.d/writefreely script and add mysql into the REQUIRE line, but then I thought to myself, I can’t be the only person who had this problem, right? I mean, I know that the script will be overwritten during the next upgrade. What’s the actual solution here?

After searching a bit, I found the article Override rc order in FreeBSD, so based on that, I created the following file: /usr/local/etc/rc.d/__writefreely which has the following content

#!/bin/sh

# PROVIDE: __writefreely
# REQUIRE: mysql
# BEFORE: writefreely

This is a much cleaner way to do things, let’s check the rcorder again

# rcorder /usr/local/etc/rc.d/* 2>/dev/null
mysql-server
rsyncd
garb
__writefreely
writefreely

Much, much better. After restarting the jail, however, I noticed that WriteFreely is still not running… huh?

Oh, of course, I just needed to do chmod +x __writefreely

And now it works.

Reply via email.