From: Guillaume Delacour <gui@iroqwa.org>
Description: Additions for service unit file
 - Use wrapper script for /etc/memcached.conf
 - Document man page
 - Use a pidfile
 - Try to automatically restart the service when
Last-Update: 2017-09-13
Forwarded: not-needed

Index: memcached/scripts/memcached.service
===================================================================
--- memcached.orig/scripts/memcached.service
+++ memcached/scripts/memcached.service
@@ -12,10 +12,10 @@
 [Unit]
 Description=memcached daemon
 After=network.target
+Documentation=man:memcached(1)
 
 [Service]
-EnvironmentFile=/etc/sysconfig/memcached
-ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS
+ExecStart=/usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf
 
 # Set up a new file system namespace and mounts private /tmp and /var/tmp
 # directories so this service cannot access the global directories and
@@ -68,5 +68,10 @@ RestrictAddressFamilies=AF_INET AF_INET6
 # Takes away the ability to create or manage any kind of namespace
 ##safer##RestrictNamespaces=true
 
+PIDFile=/var/run/memcached/memcached.pid
+
+# try to restart if errors encountered
+Restart=always
+
 [Install]
 WantedBy=multi-user.target
