my /etc/systemd/system/redis.service is
# /etc/systemd/system/redis.service
[Unit]
Description=Redis Server
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
Type=notify
#Type=forking
[Install]
WantedBy=multi-user.target
work fine.
But when I change Type from "notify" to the web suggestion "forking" I got the error and cannot restart or stop the redis.server
$systemctl restart redis
Job for redis.service failed because a timeout was exceeded. See "systemctl status redis.service" and "journalctl -xe" for details.
We’d need to see your redis.conf
file to be sure, but according to this default configuration file, redis-server
doesn’t daemonize by default, which means that Type=forking
is definitely incorrect. Type=notify
seems to be the best option, since redis supports explicit readiness notification for systemd; however, that requires the supervised
option, which is also apparently not enabled by default. So you probably want to add --supervised systemd
to the ExecStart=
directive.