Skip to content

Instantly share code, notes, and snippets.

@shahzaibalikhan
Forked from geschke/redis-server.service
Created May 10, 2016 06:23
Show Gist options
  • Save shahzaibalikhan/d0729b407dc7a3820f4c7b73e0e32e4f to your computer and use it in GitHub Desktop.
Save shahzaibalikhan/d0729b407dc7a3820f4c7b73e0e32e4f to your computer and use it in GitHub Desktop.
Ubuntu systemd service file for Redis. The server was updated to a Ubuntu 15.04 (Vivid Vervet) distribution. Redis was installed from the PPA from Roman Wookey (https://launchpad.net/~rwky/+archive/ubuntu/redis). After the switch to systemd instead of Upstart, Redis was not started by default. So I've hacked the following systemd config file. It…
[Unit]
Description=Redis Datastore Server
After=network.target
[Service]
Type=forking
PIDFile=/var/run/redis/redis.pid
ExecStartPre=/bin/mkdir -p /var/run/redis
ExecStartPre=/bin/chown redis:redis /var/run/redis
ExecStart=/sbin/start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis.pid --umask 007 --exec /usr/bin/redis-server -- /etc/redis/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
@shahzaibalikhan
Copy link
Author

With systemd, the package (.deb or .rpm) should install the *.service file in /lib/systemd/system/ (Ubuntu) or in the /usr/lib/systemd/system/ (RHEL) directory. So the script above should go into /lib/systemd/system/. - akbarahmed

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