summaryrefslogtreecommitdiffhomepage
path: root/examples/shutdown-1.0/README
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-20 15:12:52 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-20 15:12:52 +0200
commitc21dfaf836cf0eb5317035bc20395c751a205934 (patch)
tree1b9b812eb0153da450a7f9f14fd444dc0bc4b567 /examples/shutdown-1.0/README
parente09c426456cfd030cc868d93bbcb2e0a6933cabb (diff)
examples/shutdown-1.0: an example of reboot which does not signal init
For one, my inits know nothing about the concept of "shutting down the system". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'examples/shutdown-1.0/README')
-rw-r--r--examples/shutdown-1.0/README30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/shutdown-1.0/README b/examples/shutdown-1.0/README
new file mode 100644
index 000000000..40fe0ebed
--- /dev/null
+++ b/examples/shutdown-1.0/README
@@ -0,0 +1,30 @@
+# Replaces traditional overdesigned shutdown mechanism.
+#
+# No communication with init is necessary:
+# just ask all processes to exit.
+# Then unmount everything. Then reboot or power off.
+
+# Install /sbin/ symlinks named halt, reboot, poweroff
+# (and also possibly shutdown) to e.g.
+# /app/shutdown-1.0/script/shutdown:
+#
+ln -s /app/shutdown-1.0/script/shutdown /sbin/halt
+ln -s /app/shutdown-1.0/script/shutdown /sbin/reboot
+ln -s /app/shutdown-1.0/script/shutdown /sbin/poweroff
+#
+# shutdown spawns do_shutdown in new session, redirected to /dev/null,
+# tells user that shutdown is in progress, and sleeps
+# (for cosmetic reasons: do not confuse user by letting him
+# type more commands in this terminal).
+#
+# do_shutdown tries to switch to a VT console.
+# Then, (only if -r) it spawns a hardshutdown child, to reboot
+# unconditionally in 30 seconds if something later goes seriously bad.
+# Then it runs stop_tasks, writing to /var/log/reboot/YYYYMMDDhhmmss.log,
+# then it runs stop_storage.
+# Then it commands kernel to halt/reboot/poweroff, if requested.
+# Then it sleeps forever.
+#
+# Build the hardshutdown binary:
+#
+cd script && ./hardshutdown.make.sh