From f74595c11bad2b6a5cc6b424878f19545a610120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Fri, 2 Aug 2013 01:57:40 +0200 Subject: [PATCH] By user systemd service/socket Instead of having a socket for a static and predefined user http, this patch allow to easily setup multiple sockets with your needed users. This is particulary useful when you want have socket for dedicated user. You can create an http socket (in /run/fcgiwrap-http.sock) with: $ systemctl enable fcgiwrap@http.socket and if you need a socket for munin (in /run/fcgiwrap-munin.sock): $ systemctl enable fcgiwrap@munin.socket --- Makefile.in | 4 ++-- systemd/fcgiwrap.service | 11 ----------- systemd/fcgiwrap.socket | 8 -------- systemd/fcgiwrap@.service | 7 +++++++ systemd/fcgiwrap@.socket | 8 ++++++++ 5 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 systemd/fcgiwrap.service delete mode 100644 systemd/fcgiwrap.socket create mode 100644 systemd/fcgiwrap@.service create mode 100644 systemd/fcgiwrap@.socket diff --git a/Makefile.in b/Makefile.in index 97378e5..ba7d65c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,8 +12,8 @@ install: all install -m 644 fcgiwrap.8 $(man8dir) ifneq ("@systemdsystemunitdir@", "") install -d -m 755 $(DESTDIR)@systemdsystemunitdir@ - install -m 644 systemd/fcgiwrap.socket $(DESTDIR)@systemdsystemunitdir@ - install -m 644 systemd/fcgiwrap.service $(DESTDIR)@systemdsystemunitdir@ + install -m 644 systemd/fcgiwrap@.socket $(DESTDIR)@systemdsystemunitdir@ + install -m 644 systemd/fcgiwrap@.service $(DESTDIR)@systemdsystemunitdir@ endif LDLIBS = -lfcgi @systemd_LIBS@ diff --git a/systemd/fcgiwrap.service b/systemd/fcgiwrap.service deleted file mode 100644 index 7b010c9..0000000 --- a/systemd/fcgiwrap.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Simple CGI Server -After=nss-user-lookup.target - -[Service] -ExecStart=/usr/sbin/fcgiwrap -User=http -Group=http - -[Install] -Also=fcgiwrap.socket diff --git a/systemd/fcgiwrap.socket b/systemd/fcgiwrap.socket deleted file mode 100644 index dc074f1..0000000 --- a/systemd/fcgiwrap.socket +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=fcgiwrap Socket - -[Socket] -ListenStream=/run/fcgiwrap.sock - -[Install] -WantedBy=sockets.target diff --git a/systemd/fcgiwrap@.service b/systemd/fcgiwrap@.service new file mode 100644 index 0000000..9993f65 --- /dev/null +++ b/systemd/fcgiwrap@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Simple CGI Server for user %I +After=nss-user-lookup.target + +[Service] +ExecStart=/usr/sbin/fcgiwrap -s /run/fcgiwrap-%I.sock +User=%I diff --git a/systemd/fcgiwrap@.socket b/systemd/fcgiwrap@.socket new file mode 100644 index 0000000..a362c13 --- /dev/null +++ b/systemd/fcgiwrap@.socket @@ -0,0 +1,8 @@ +[Unit] +Description=fcgiwrap socket for user %I + +[Socket] +ListenStream=/run/fcgiwrap-%I.sock + +[Install] +WantedBy=sockets.target