On Wed, 6 Jul 2022 12:07:59 -0400 Timothy M Butterworth <timothy.m.butterwo...@gmail.com> wrote:
> On Tue, Jul 5, 2022 at 2:15 PM Chris Mitchell <ch...@oldnest.ca> > wrote: > > > I have a unit file named email-notify@.service with contents: > > [Unit] > > Description=%i email notification > > > > [Service] > > Type=oneshot > > > > ExecStart=/bin/bash -c '/bin/systemctl status %i | > > /usr/bin/mail \ -s "%H: %i $(/bin/systemctl show -p ActiveState > > --value %i)" root' > > Are you creating this file in: /usr/lib/systemd/system or > /etc/systemd/system/ > /etc/systemd/system/ As I understand it, files under /usr/lib/systemd/system should only be created or modified by packages. A sysadmin who wants to add new units should always put them under /etc/systemd/system. Bonus tip: overrides to package-provided units should also go under /etc/systemd/system, even if the original unit files are in /usr/lib/systemd/system. The command `systemctl edit <unit>` automatically creates the precisely named path and file for this purpose. The official systemd documentation is not the most readable thing ever, but it's pretty thorough, and does detail the hierarchy of unit file and override locations. https://www.freedesktop.org/software/systemd/man/systemd.unit.html Cheers! -Chris PS: Please keep all replies on-list so others can benefit from follow-up questions and answers.