aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-03-25 13:10:13 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-03-25 13:28:07 +0200
commit021f091082a74d5bd5503a3a3c7a569eee9c6d8f (patch)
tree5a1c742a3e4a1933ed3a54f39a7069f97e2500f1 /services
parent0a280740716bde571c0f0db64d78a7f2141b56f4 (diff)
Use services to implement shutdown/reboot sequence
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'services')
-rw-r--r--services/Makemodule.am2
-rw-r--r--services/reboot.in8
-rw-r--r--services/shutdown.in8
-rw-r--r--services/sigkill.in9
-rw-r--r--services/sigterm.in10
-rw-r--r--services/sync.in9
6 files changed, 46 insertions, 0 deletions
diff --git a/services/Makemodule.am b/services/Makemodule.am
index 88c34a4..c9eeeec 100644
--- a/services/Makemodule.am
+++ b/services/Makemodule.am
@@ -1,5 +1,7 @@
initdir = @TEMPLATEDIR@
init_DATA = services/agetty services/hostname services/loopback
init_DATA += services/sysctl services/hwclock services/sysinit
+init_DATA += services/reboot services/shutdown services/sigkill
+init_DATA += services/sigterm services/sync
EXTRA_DIST += services/sysinit
diff --git a/services/reboot.in b/services/reboot.in
new file mode 100644
index 0000000..f913013
--- /dev/null
+++ b/services/reboot.in
@@ -0,0 +1,8 @@
+name = "reboot"
+description = "system reboot"
+exec = "@SBINPATH@/shutdown -nrf"
+type = wait
+target = reboot
+after = "sync"
+after = "sigkill"
+after = "sigterm"
diff --git a/services/shutdown.in b/services/shutdown.in
new file mode 100644
index 0000000..c97cde9
--- /dev/null
+++ b/services/shutdown.in
@@ -0,0 +1,8 @@
+name = "shutdown"
+description = "system shutdown"
+exec = "@SBINPATH@/shutdown -npf"
+type = wait
+target = shutdown
+after = "sync"
+after = "sigkill"
+after = "sigterm"
diff --git a/services/sigkill.in b/services/sigkill.in
new file mode 100644
index 0000000..24677e4
--- /dev/null
+++ b/services/sigkill.in
@@ -0,0 +1,9 @@
+name = "sigkill"
+description = "send SIGKILL to remaining processes"
+exec = "@SCRIPTDIR@/killall5 9"
+type = wait
+target = "%0"
+after = "sigterm"
+before = "sync"
+before = "shutdown"
+before = "reboot"
diff --git a/services/sigterm.in b/services/sigterm.in
new file mode 100644
index 0000000..c98e037
--- /dev/null
+++ b/services/sigterm.in
@@ -0,0 +1,10 @@
+name = "sigterm"
+description = "send SIGTERM to all processes"
+exec = "@SCRIPTDIR@/killall5 15"
+exec = "@BINPATH@/sleep 5"
+type = wait
+target = "%0"
+before = "sigkill"
+before = "sync"
+before = "reboot"
+before = "shutdown"
diff --git a/services/sync.in b/services/sync.in
new file mode 100644
index 0000000..7371b56
--- /dev/null
+++ b/services/sync.in
@@ -0,0 +1,9 @@
+name = "sync"
+description = "sync"
+exec = "@BINPATH@/sync"
+type = wait
+target = "%0"
+after = "sigkill"
+after = "sigterm"
+before = "reboot"
+before = "shutdown"