summaryrefslogtreecommitdiff
path: root/shutdown-if-no-sessions
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-01-25 00:56:34 +0100
committerAki <please@ignore.pl>2024-01-25 00:56:34 +0100
commit4a0697a0e19fcf7b19abbabffb14cba33aee3491 (patch)
tree1d16f245d2098ac4f08aa42b5b546cdcd5569e86 /shutdown-if-no-sessions
downloadsystemd-ready-for-shutdown-4a0697a0e19fcf7b19abbabffb14cba33aee3491.zip
systemd-ready-for-shutdown-4a0697a0e19fcf7b19abbabffb14cba33aee3491.tar.gz
systemd-ready-for-shutdown-4a0697a0e19fcf7b19abbabffb14cba33aee3491.tar.bz2
Naive approach that seems to work with mayohiga
One of the important flaws is that if one of the intended services will not run, then shutdown may not happen at all. With current mayohiga setup this will not happen but it may break in any other case.
Diffstat (limited to 'shutdown-if-no-sessions')
-rwxr-xr-xshutdown-if-no-sessions4
1 files changed, 4 insertions, 0 deletions
diff --git a/shutdown-if-no-sessions b/shutdown-if-no-sessions
new file mode 100755
index 0000000..285eb70
--- /dev/null
+++ b/shutdown-if-no-sessions
@@ -0,0 +1,4 @@
+#!/bin/sh
+if ! who | grep -e tty -e pts; then
+ systemctl poweroff
+fi