I'm using Gentoo, and since bees comes with a systemd service but I'm using OpenRC, I decided to write my own initscript. It is based somewhat on the beesd script (which I couldn't just use directly since it wouldn't work with start-stop-daemon), and designed to work with a conf.d file that's similar to the one that's installed in /etc/bees, but with some additional options added to control logging and {io,}nice level. It also avoids bashisms so that it can be run with dash as /bin/sh.
Is this something you would be interested in merging upstream? My /etc/init.d file can be found here: https://github.com/automorphism88/gentoo-overlay/blob/master/sys-fs/bees/files/bees.initd and the corresponding template /etc/conf.d file can be found here: https://github.com/automorphism88/gentoo-overlay/blob/master/sys-fs/bees/files/bees.confd. Note that while this initscript works for me, it should be considered experimental. I haven't tried to get this merged into the official Gentoo ebuild yet since I figured it would be even better to upstream the script directly into bees.
A few things I noticed about the beesd script when I was using it as a reference were:
- Is there some reason to
chmod 700 the database file instead of chmod 600? Executable permission doesn't seem to be necessary.
stat -c %s FILE is a simpler, faster, and more portable way of checking file size than the method used in the beesd script (which, I believe, relies on a GNU extension in sed to interpret \t as tab). Incidentally, stat -c %i can also be used to check whether a directory is a btrfs subvolume, since a btrfs subvolume will have an inode number of 256.
- Why not mount the root subvolume with
noatime? Unlike btrfs-specific mount options like compression, this one can be set per-subvolume, so it will default to relatime even if the rest of the filesystem is mounted with noatime. Probably wouldn't make much difference in this case, I'm just in the habit of using noatime everywhere unless there's a specific need to do otherwise.
I'm using Gentoo, and since bees comes with a systemd service but I'm using OpenRC, I decided to write my own initscript. It is based somewhat on the
beesdscript (which I couldn't just use directly since it wouldn't work withstart-stop-daemon), and designed to work with aconf.dfile that's similar to the one that's installed in/etc/bees, but with some additional options added to control logging and {io,}nice level. It also avoids bashisms so that it can be run with dash as/bin/sh.Is this something you would be interested in merging upstream? My
/etc/init.dfile can be found here: https://github.com/automorphism88/gentoo-overlay/blob/master/sys-fs/bees/files/bees.initd and the corresponding template/etc/conf.dfile can be found here: https://github.com/automorphism88/gentoo-overlay/blob/master/sys-fs/bees/files/bees.confd. Note that while this initscript works for me, it should be considered experimental. I haven't tried to get this merged into the official Gentoo ebuild yet since I figured it would be even better to upstream the script directly into bees.A few things I noticed about the
beesdscript when I was using it as a reference were:chmod 700the database file instead ofchmod 600? Executable permission doesn't seem to be necessary.stat -c %s FILEis a simpler, faster, and more portable way of checking file size than the method used in the beesd script (which, I believe, relies on a GNU extension in sed to interpret\tas tab). Incidentally,stat -c %ican also be used to check whether a directory is a btrfs subvolume, since a btrfs subvolume will have an inode number of 256.noatime? Unlike btrfs-specific mount options like compression, this one can be set per-subvolume, so it will default torelatimeeven if the rest of the filesystem is mounted withnoatime. Probably wouldn't make much difference in this case, I'm just in the habit of usingnoatimeeverywhere unless there's a specific need to do otherwise.