summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-04-27 14:14:18 +0200
committerErich Eckner <git@eckner.net>2020-04-27 14:14:18 +0200
commit67443d378c3e9d25e8da351324e8bb5f6695e625 (patch)
tree9ea9d145a5202699edea0b11611cecf3c8492bc7
parent1d54556bc7c6ba96bd81631de5dfda3f29194337 (diff)
downloadcheck-kernel-67443d378c3e9d25e8da351324e8bb5f6695e625.tar.xz
check-kernel: use shutdownasap instead of reboot - if available
-rw-r--r--check-kernel.in31
1 files changed, 22 insertions, 9 deletions
diff --git a/check-kernel.in b/check-kernel.in
index 6e6899c..823485f 100644
--- a/check-kernel.in
+++ b/check-kernel.in
@@ -157,15 +157,28 @@ else
"${installed}" \
"${running}"
if ${reboot}; then
- if ! reboot_check_hook; then
- >&2 printf 'reboot_check_hook() failed.\n'
- exit 1
- fi
- >&2 printf 'Press enter to reboot %s ...' \
- "$(hostname)"
- read s
- if [ -z "${s}" ]; then
- PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin reboot
+ if command -v shutdownasap >/dev/null; then
+ >&2 printf 'Press enter to reboot %s ...' \
+ "$(hostname)"
+ read s
+ if [ -z "${s}" ]; then
+ if command -v screen >/dev/null; then
+ shutdownasap -r
+ else
+ screen -d -m 'shutdownasap -r'
+ fi
+ fi
+ else
+ if ! reboot_check_hook; then
+ >&2 printf 'reboot_check_hook() failed.\n'
+ exit 1
+ fi
+ >&2 printf 'Press enter to reboot %s ...' \
+ "$(hostname)"
+ read s
+ if [ -z "${s}" ]; then
+ PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin reboot
+ fi
fi
else
exit 1