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

Tobias Hunger tobias.hunger at gmail.com
Mon May 5 03:38:01 PDT 2014


Hi Austin,

this does sound like a use-case for "RuntimeDirectory=". See
http://www.freedesktop.org/software/systemd/man/systemd.exec.html for
details. That is simpler and makes sure the directory is
created/cleaned up as needed by systemd as the job is started/stopped.

That is available since systemd 211 IIRC, but that should be no
problem in gentoo:-)

Best Regards,
Tobias

On Sat, May 3, 2014 at 10:31 AM, Austin Matherne
<austinmatherne at gmail.com> wrote:
> Thank you, that worked perfectly.
>
>
> On Sat, May 3, 2014 at 3:14 AM, Kirill Elagin <kirelagin at gmail.com> wrote:
>>
>> That's how you do this in systemd:
>> http://pkgs.fedoraproject.org/cgit/couchdb.git/tree/couchdb.tmpfiles.conf
>>
>> https://projects.archlinux.org/svntogit/community.git/tree/trunk/couchdb.tmpfiles?h=packages/couchdb
>>
>>
>> --
>> Кирилл Елагин
>>
>>
>> On Sat, May 3, 2014 at 12:03 PM, Austin Matherne
>> <austinmatherne at gmail.com> wrote:
>>>
>>> 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
>>>
>>> _______________________________________________
>>> systemd-devel mailing list
>>> systemd-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>>
>>
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


More information about the systemd-devel mailing list