Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#31378 - [redis] Missing systemd unit file

Attached to Project: Community Packages
Opened by Eivind Uggedal (uggedal) - Saturday, 01 September 2012, 16:02 GMT
Last edited by Sergej Pupykin (sergej) - Thursday, 11 October 2012, 11:39 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

I've created a systemd service unit[1] for Redis and updated the PKGBUILD[2] (I also bumped the version to 2.4.17).

The unit file is compatible with the installed redis.conf since it detects the double fork from 'daemonize yes' and gets the PID from /run/redis.pid.

On shutdown it calls '/usr/bin/redis-cli shutdown' before systemd potentially kills the process. In the limited systemd ini syntax I was unable to get a potential password from /etc/redis.conf to use with the redis-cli command like the rc script does.

[1]: https://github.com/uggedal/pkg/blob/master/redis/redis.service
[2]: https://github.com/uggedal/pkg/blob/master/redis/PKGBUILD
This task depends upon

Closed by  Sergej Pupykin (sergej)
Thursday, 11 October 2012, 11:39 GMT
Reason for closing:  Fixed
Comment by Eivind Uggedal (uggedal) - Wednesday, 05 September 2012, 14:53 GMT
  • Field changed: Percent Complete (100% → 0%)
I've implemented support for gracefully shutting down redis from systemd with a password in redis.conf by using an external systemd script. See this commit:

https://github.com/uggedal/pkg/commit/19a3baba08e5b09ad001a42993928800ca718916
Comment by Dave Reisner (falconindy) - Wednesday, 05 September 2012, 15:01 GMT
Is that mess really needed? Why can't redis handle a graceful shutdown with a SIGTERM like so many other daemons do?
Comment by Eivind Uggedal (uggedal) - Wednesday, 05 September 2012, 16:37 GMT
You are correct, the SIGTERM handling is the same as the shutdown command:

https://github.com/antirez/redis/blob/2.4/src/redis.c#L564

https://github.com/antirez/redis/blob/2.4/src/db.c#L348

I'm not sure why the rc script does not rely on this.
Comment by Sergej Pupykin (sergej) - Monday, 17 September 2012, 11:10 GMT
rc script does

[ -d /proc/${PID} ] && sleep ...

just to wait for daemon shutdown. Systemd probably does not need this.

Loading...