Report this

What is the reason for this report?

What's the purpose of these directives inside redis unit file? Are they needed?

Posted on September 28, 2018
LS1

By LS1

I am asking because in this redis tutorial link the author does not mention these.

[install]
ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d
ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d
ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d

PrivateTmp=yes
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
CapabilityBoundingSet=~CAP_SYS_PTRACE

# redis-server writes its own config file when in cluster mode so we allow
# writing there (NB. ProtectSystem=true over ProtectSystem=full)
ProtectSystem=true
ReadWriteDirectories=-/etc/redis

Also: In unit description, can we write whatever word we want or must be some directive.

[Unit]
Description=Advanced key-value store


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Your systemd service seems more comprehensive compared to the one you’ve linked. It’s a good thing. Generally, the more elaborate your service file the more stable the service is going to be. Not always but generally speaking.

So to answer your question, they’re not absolutely necessary but you’re better off with them than without. You’re also free to describe your Unit however you want. It’s free form and isn’t a directive.

Yes, they are not necessary.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.