Systemd Persistent Change To Service File

Home » CentOS » Systemd Persistent Change To Service File
CentOS 2 Comments

Hi All,

I had my database fall over earlier, Initially I thought it was due to a change in the OS but the PostgreSQL update overwrote my systemd service file.

How can I create a file for my PostgreSQL service that will not be overwritten when updates are applied?

Am I correct in thinking it will be something like

vi /etc/systemd/system/PostgreSQL.service.d/PostgreSQL-limit-stack.conf
#with the contents:
.include /etc/systemd/system/multi-user.target.wants/PostgreSQL.service
[Service]
LimitSTACK825792

thanks

Michael

2 thoughts on - Systemd Persistent Change To Service File

  • Use “systemctl edit ” to edit a drop-in snippet.

    This will create a file in /etc/systemd/system/.d/ that overrides settings in the unit file packaged in the rpm. You only need to specify the settings which you wish to override.

    See man pages for systemctl, systemd.unit, and systemd-delta for more information.

  • Note that when doing the .d override you must not do the .include … the override already includes anythign else (hence override) and the override mechanism was intended to replace the .include stuff due to the fragility of that method.

LEAVE A COMMENT