Created
January 20, 2022 03:32
-
-
Save takeru/1a56a913903a8420cc78155f01f7b416 to your computer and use it in GitHub Desktop.
ラズパイの右下のUSBになにか刺したらシャットダウンします〜
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/shutdown_by_usb.service | |
[Unit] | |
Description=shutdown_by_usb | |
[Service] | |
Type=simple | |
ExecStart=bash -c 'while : ; do if [ -e /sys/bus/usb/devices/1-1.2 ] ; then echo "shutdown_by_usb!"; sleep 5; sudo shutdown -h now; sleep 60; else true; fi; sleep 1; $ | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
## (osusume) | |
## sudo nano /boot/config.txt | |
## dtparam=pwr_led_trigger=heartbeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment