home · contact · privacy
Guard against "systemctl hibernate" calls not ensuring proper shutdown.
authorPlom Heller <plom@plomlompom.com>
Sat, 12 Sep 2026 22:20:45 +0000 (00:20 +0200)
committerPlom Heller <plom@plomlompom.com>
Sat, 12 Sep 2026 22:20:45 +0000 (00:20 +0200)
home/root/.aliases
home/user/.aliases

index f0ff635ab2bac0ea513e6c577154050d9b3952a8..41d452e3c42e5209cd47161d6b56d62d22db4b36 100644 (file)
@@ -1,2 +1,8 @@
 alias ls="ls --color=auto"
 
+hibernate_safe="systemctl hibernate || systemctl poweroff"
+systemctl () {
+    local MSG="Use 'hibernate_safe' instead."
+    [ "$@" = "hibernate" ] && echo "${MSG}" && return 1
+    command systemctl "$@"
+}
index fbd9533e241a25115887d265319bffc2f286760d..86f902991ff7e1804ac9916fb1ecbf4e11226207 100644 (file)
@@ -1 +1,8 @@
 alias ls="ls --color=auto"
+
+hibernate_safe="sudo -i hibernate_safe"
+sudo() {
+    local MSG="Use 'hibernate_safe' instead."
+    [ "$1 $2" = "systemctl hibernate" ] && echo "${MSG}" && return 1
+    command sudo "$@"
+}