[systemd-devel] Unit File: Create Folder With User Permissions

Austin Matherne austinmatherne at gmail.com
Sat May 3 01:03:20 PDT 2014


I switched my Gentoo install over to systemd today and pretty much
everything worked flawlessly. The only exception was CouchDB, which lacks
systemd support in Portage, so I'm left writing my own service file.

I took a peak at the files for Fedora (
http://pkgs.fedoraproject.org/cgit/couchdb.git/tree/couchdb.service) and
Arch (
https://projects.archlinux.org/svntogit/community.git/tree/trunk/couchdb.service?h=packages/couchdb)
to get an idea of what it should look like. I copied the service from Arch,
as it looked particularly appropriate:


[Unit]
Description=CouchDB Server

[Service]
User=couchdb
Type=forking
PermissionsStartOnly=true
ExecStart=/usr/bin/couchdb -b -o /dev/null -e /dev/null
ExecStop=/usr/bin/couchdb -d

[Install]
WantedBy=multi-user.target



However, there's a problem with this implementation. The original Gentoo
init script created the folder /var/run/couchdb with the correct
permissions for user couchdb at runtime using a helper
function (checkpath). How can I do this with a systemd service?

The original Gentoo init (
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/couchdb/files/couchdb.init-4?view=markup)
and config (
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/couchdb/files/couchdb.conf-2?view=markup)
files for reference.

Any help with this would be greatly appreciated.

Thanks,
Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140503/1c83c717/attachment.html>


More information about the systemd-devel mailing list