Skip to content

Instantly share code, notes, and snippets.

@berkayunal
Forked from ordoghl/redis.service
Created February 10, 2017 01:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save berkayunal/402180516e1f2db0e3a87f7e2df499f2 to your computer and use it in GitHub Desktop.
Save berkayunal/402180516e1f2db0e3a87f7e2df499f2 to your computer and use it in GitHub Desktop.
redis systemd unit file
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
Environment=statedir=/run/redis
PermissionsStartOnly=true
PIDFile=/run/redis/redis.pid
ExecStartPre=/bin/touch /var/log/redis.log
ExecStartPre=/bin/chown redis:redis /var/log/redis.log
ExecStartPre=/bin/mkdir -p ${statedir}
ExecStartPre=/bin/chown -R redis:redis ${statedir}
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
@skaurus
Copy link

skaurus commented Sep 19, 2023

I believe you forgot [Unit] as a first line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment