From 08037faaa7dafb3d76278ccd36fdbb131b7ed743 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 20 Jan 2021 10:22:22 +0100 Subject: [PATCH] Add reboot-notify service Add service to send output of `last -20 reboot` to the mail-alias reboot-notify. --- install.sh | 1 + misc_systemd_units/reboot-notify.service | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 misc_systemd_units/reboot-notify.service diff --git a/install.sh b/install.sh index 03f5cea..8b16432 100755 --- a/install.sh +++ b/install.sh @@ -209,6 +209,7 @@ install_symlink /usr/bin/ptype "$DESTDIR$usrlocal_pre install_symlink /usr/bin/pman "$DESTDIR$usrlocal_prefix/package/bin/pman" install_data misc_etc_files/sysctl.conf "$DESTDIR$sysconfdir/sysctl.conf" install_data misc_etc_files/udev/rules.d/51-mariux.rules "$DESTDIR$sysconfdir/udev/rules.d/51-mariux.rules" +install_data misc_systemd_units/reboot-notify.service "$DESTDIR$systemdunitdir/reboot-notify.service" postinstall exit diff --git a/misc_systemd_units/reboot-notify.service b/misc_systemd_units/reboot-notify.service new file mode 100644 index 0000000..fb5ec0c --- /dev/null +++ b/misc_systemd_units/reboot-notify.service @@ -0,0 +1,11 @@ +[Unit] +Requires=network.target +After=network.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=bash -c 'last -20 reboot|mailx -s "[REBOOT] $(hostname)" reboot-notify' + +[Install] +WantedBy=multi-user.target