Search code examples
redissystemd

systemctl start not returning/exiting


I'm trying to start a service file for redis, I've read many posts about running it as a systemd service and I'm not sure why this is happening.

When I run sudo systemctl start redis-server.service it doesn't return/exit - just sits there with the cursor flashing until I Ctrl-C. I've confirmed the server is up and running so the server seems to be working fine - I'm not sure why systemctl start never exits. Redis is meant to work with systemd and with the argument --supervised systemd the service should be Type=notify.

My service file is:

[Unit]
Description=Redis

[Service]
Type=notify
User=john
Group=john
ExecStart=/usr/local/bin/redis-server /home/john/redis/redis.conf --supervised systemd --daemonize no
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=on-success
WorkingDirectory=/home/john/redis

[Install]
WantedBy=multi-user.target

The contents of redis.conf is:

port              6379
save              60 1
bind              127.0.0.1
tcp-keepalive     300
dbfilename        dump.rdb
dir               ./
logfile           ./redis-server.log

Solution

  • It seems from version 6 of redis it needs to be compiled with the libsystemd-dev package installed on Ubuntu + Debian. See this GitHub issue: https://github.com/redis/redis/issues/7284.

    Installing this package and recompiling redis fixed the issue.