[systemd-devel] Simple question.

Reindl Harald h.reindl at thelounge.net
Fri Jan 25 08:50:23 PST 2013



Am 25.01.2013 17:42, schrieb Daniel J Walsh:
> How would I write a unit file to run an apache service as the user dwalsh (3267)
why would someone do this with systemd?
httpd needs to get started as root to bind the port!

systemd supports such nice things but it is completly
wrong for daemons which do this native

Nice=19
IOSchedulingClass=3
User=wwwcron
Group=apache
_________________________________________

point to whatever httpd.conf and set there user/group
which has to be used after forking and bind the ports

User    apache
Group   apache
_________________________________________

[root at srv-rhsoft:~]$ cat /usr/lib/systemd/system/httpd-lounge-worker.service
[Unit]
Description=HTTP-Lounge-Worker

[Service]
Type=forking
PIDFile=/var/run/httpd/httpd-lounge-worker.pid
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -f /Volumes/dune/httpd-worker/conf/httpd.conf -k start
ExecReload=/usr/sbin/httpd $OPTIONS -f /Volumes/dune/httpd-worker/conf/httpd.conf -t
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/usr/sbin/httpd $OPTIONS -f /Volumes/dune/httpd-worker/conf/httpd.conf -k stop
Restart=always
RestartSec=1

[Install]
WantedBy=multi-user.target

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130125/c78c49c7/attachment.pgp>


More information about the systemd-devel mailing list