From f74056bec3910ef03b6e993084731b482ba359ba Mon Sep 17 00:00:00 2001 From: anthraxx Date: Wed, 19 Dec 2018 01:00:32 +0100 Subject: [PATCH] modern configuration purely using systemd overrides --- scripts/memcached.service | 12 ++++++++++-- scripts/memcached@.service | 15 +++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/memcached.service b/scripts/memcached.service index 88a4b8a..3a1e87e 100644 --- a/scripts/memcached.service +++ b/scripts/memcached.service @@ -7,6 +7,9 @@ # # [Service] # Environment=OPTIONS="-l 127.0.0.1,::1" +# +# To use the "instanced" version of this, just start 'memcached@11211' or +# whatever port you'd like. [Unit] @@ -14,8 +17,13 @@ Description=memcached daemon After=network.target [Service] -EnvironmentFile=/etc/sysconfig/memcached -ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS +User=memcached +Environment=CACHESIZE=64 +Environment=MAXCONN=1024 +Environment=LISTEN="-l 127.0.0.1,::1" +Environment=OPTIONS="-o modern,drop_privileges" +ExecStart=/usr/bin/memcached -m ${CACHESIZE} -c ${MAXCONN} $LISTEN $OPTIONS +Restart=always # Set up a new file system namespace and mounts private /tmp and /var/tmp # directories so this service cannot access the global directories and diff --git a/scripts/memcached@.service b/scripts/memcached@.service index 4e9f1d7..e666da9 100644 --- a/scripts/memcached@.service +++ b/scripts/memcached@.service @@ -9,18 +9,21 @@ # Environment=OPTIONS="-l 127.0.0.1,::1" # # To use the "instanced" version of this, just start 'memcached@11211' or -# whatever port you'd like. If /etc/sysconfig/memcached. exists, it -# will be read first, so you can set different parameters for a given -# instance. +# whatever port you'd like. + [Unit] Description=memcached daemon After=network.target [Service] -EnvironmentFile=/etc/sysconfig/memcached -EnvironmentFile=-/etc/sysconfig/memcached.%i -ExecStart=/usr/bin/memcached -p %i -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS +User=memcached +Environment=CACHESIZE=64 +Environment=MAXCONN=1024 +Environment=LISTEN="-l 127.0.0.1,::1" +Environment=OPTIONS="-o modern,drop_privileges" +ExecStart=/usr/bin/memcached -p %i -m ${CACHESIZE} -c ${MAXCONN} $LISTEN $OPTIONS +Restart=always # Set up a new file system namespace and mounts private /tmp and /var/tmp # directories so this service cannot access the global directories and -- 2.20.1