Editing an existing service
We've seen that the unit files for our services live in the /lib/systemd/system/
directory, so your first instinct might be to go there and edit files in your favorite text editor. You don't want to do that though, even though it would work. If you were to do a system update, it might overwrite the files that you edited, and you'd lose your changes.
The proper way to do this is to create edited versions of your service files in the /etc/systemd/system/
directory. You can do that with your favorite text editor, the same as you would with any other configuration file. Indeed, that's the way that you used to have to do it. When Red Hat released RHEL 7.2, they added an edit
function to the systemctl
command, which makes life much easier. (Of course, that edit
function is now available on all Linux distros that run systemd
.)
Note
It has been brought to my attention that some people prefer to add their own custom unit files to the...