This repository has been archived on 2024-05-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
pi-imgtank/files/usr/local/sbin/halt_on_plugout
T
2020-07-06 16:05:28 +02:00

27 lines
784 B
Bash
Executable File

#!/bin/bash
# ---------------------------------------------------------------------------
# This script is triggered by an udev-rule in /etc/udev/rules.d/99-usbhalt.rules.
# It shuts down the system after plugout of any (!!) sd-device.
#
# Author: Bernhard Bablok
# License: GPL3
#
# Website: https://github.com/bablokb/pi-imgtank
#
# ---------------------------------------------------------------------------
source $(dirname "$0")/copy_mv_img2.inc
# --- global settings -----------------------------------------------------
setDefaults() {
setGlobalDefaults
}
# --- main program ---------------------------------------------------------
setDefaults
# no way to check the device: it is already removed :-(
msg "info: initiating system halt"
systemctl --no-block poweroff