[systemd-devel] [PATCH] correctly mark system reboot

Andrey Borzenkov arvidjaar at gmail.com
Wed Mar 2 00:41:26 PST 2011


It is expected that system will put "reboot" in wtmp to mark
when it starts coming up. This is looked for by "who -b" and is
used by "last" to calculate correct time spent by various programs.
Add systemd-update-utmp-reboot.service which is started as soon
as possible after local-fs.target to mark reboot.

Signed-off-by: Andrey Borzenkov <arvidjaar at gmail.com>

---
 Makefile.am                                 |    4 ++++
 units/systemd-update-utmp-reboot.service.in |   16 ++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1841ad5..54786e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -258,6 +258,7 @@ nodist_systemunit_DATA = \
 	units/systemd-modules-load.service \
 	units/systemd-vconsole-setup.service \
 	units/systemd-remount-api-vfs.service \
+	units/systemd-update-utmp-reboot.service \
 	units/systemd-update-utmp-runlevel.service \
 	units/systemd-update-utmp-shutdown.service \
 	units/systemd-random-seed-save.service \
@@ -303,6 +304,7 @@ EXTRA_DIST = \
 	units/systemd-modules-load.service.in \
 	units/systemd-vconsole-setup.service.in \
 	units/systemd-remount-api-vfs.service.in \
+	units/systemd-update-utmp-reboot.service \
 	units/systemd-update-utmp-runlevel.service.in \
 	units/systemd-update-utmp-shutdown.service.in \
 	units/systemd-random-seed-save.service.in \
@@ -1276,6 +1278,7 @@ install-data-hook:
 			systemd-tmpfiles-setup.service \
 			systemd-sysctl.service \
 			systemd-ask-password-console.path \
+			systemd-update-utmp-reboot.service \
 			cryptsetup.target && \
 		$(LN_S) ../dev-hugepages.automount dev-hugepages.automount && \
 		$(LN_S) ../dev-mqueue.automount dev-mqueue.automount && \
@@ -1288,6 +1291,7 @@ install-data-hook:
 		$(LN_S) ../systemd-tmpfiles-setup.service systemd-tmpfiles-setup.service && \
 		$(LN_S) ../systemd-sysctl.service systemd-sysctl.service && \
 		$(LN_S) ../systemd-ask-password-console.path systemd-ask-password-console.path && \
+		$(LN_S) ../systemd-update-utmp-reboot.service systemd-update-utmp-reboot.service && \
 		$(LN_S) ../cryptsetup.target cryptsetup.target )
 	( cd $(DESTDIR)$(systemunitdir)/basic.target.wants && \
 		rm -f systemd-tmpfiles-clean.timer && \
diff --git a/units/systemd-update-utmp-reboot.service.in b/units/systemd-update-utmp-reboot.service.in
new file mode 100644
index 0000000..e6ccda3
--- /dev/null
+++ b/units/systemd-update-utmp-reboot.service.in
@@ -0,0 +1,16 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Notify Audit System and Update UTMP about System Reboot
+DefaultDependencies=no
+Wants=local-fs.target
+After=local-fs.target systemd-tmpfiles-setup.service
+
+[Service]
+Type=oneshot
+ExecStart=@rootlibexecdir@/systemd-update-utmp reboot
-- 
tg: (fc7a744..) upstream/utmp-reboot (depends on: origin/master)


More information about the systemd-devel mailing list