Skip to content

Instantly share code, notes, and snippets.

@cameronelliott
Forked from sshymko/redis.service
Last active February 5, 2020 06:23
Show Gist options
  • Save cameronelliott/9895bb4d2036404479b4743c09e4ba4e to your computer and use it in GitHub Desktop.
Save cameronelliott/9895bb4d2036404479b4743c09e4ba4e to your computer and use it in GitHub Desktop.
Redis service for systemd on Linux
# Redis for Coturn systemd file
#
# Credit to the giants before me.
#
# apparently comments are allowed on recent versions of systemd, ala ubuntu 18.04+
#
# the timeout and tcp-keepalive flags are per coturn recommendations,
# but really would seem to be most helpful in WAN/Internet scenarios
# see: https://github.com/coturn/coturn/blob/master/turndb/schema.stats.redis
#
[Unit]
Description=Redis persistent key-value storage
After=network.target
[Service]
Type=notify
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd --daemonize no --timeout 0 --tcp-keepalive 60
ExecStop=/usr/bin/redis-cli -p 6379 shutdown
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment