Bug ID 1171126
Summary [doc] 10.5.1 Customizing Unit Files
Classification openSUSE
Product openSUSE Distribution
Version Leap 15.2
Hardware x86-64
OS openSUSE Factory
Status NEW
Severity Enhancement
Priority P5 - None
Component Documentation
Assignee fs@suse.com
Reporter lars.vogdt@suse.com
QA Contact fs@suse.com
Found By ---
Blocker ---

I see the following as a suggestion. The original documentation is also ok (but
IMHO misses the information to run: `systemctl daemon-reload` after doing
changes).


10.5.1  Customizing Unit Files

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-systemd.html#sec-boot-systemd-custom-service


-----------------[enhancement]

The preferred way to customize unit files is to use the command: 
  `systemctl edit $name.service`

This opens an empty page in the default command line editor, automatically
creates a sub-directory below /etc/systemd/system/$name.service.d/ and a file
named "override.conf" in this directory. It also ensures that the running
systemd process get's notified about the changes.

As the `systemctl edit $name.service` command opens a completely empty page, we
recommend to open the original service file in another window, which would
allow to minimize the changes. As alternative, you might call `systemctl edit
--full $name.service` to get a copy of the original file opened for editing.

Note: please make sure to have the correct sections (like: `[Service]`)
mentioned in the edited file. 

Example:

/usr/lib/systemd/system/mariadb.service contains:
```
[Unit]
Description=MySQL server
Wants=basic.target
Conflicts=mariadb.target
After=basic.target network.target 

[Service]
Restart=on-abort
Type=notify
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper  install
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper  upgrade
ExecStart=/usr/lib/mysql/mysql-systemd-helper     start

# Configures the time to wait for start-up/stop
TimeoutSec=300

[Install]
WantedBy=multi-user.target
Alias=mysql.service
```

To enhance the given Timeout of 300 seconds, type: 
  `systemctl edit mariadb.service`

and add the following lines:
```
[Service]
TimeoutSec=7200
```
(This results in systemd waiting 2 hours for the successful start of mariadb
instead of 5 minutes, which might be too short for big databases.)

More information is available via `man 1 systemctl`.


You are receiving this mail because: