Adding batt check and fixed MC to use full path
This commit is contained in:
2
batt_check/batt_check
Executable file
2
batt_check/batt_check
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
BATTINFO=$(acpi -b | grep Discharging || echo 100\%) && [[ $( echo "$BATTINFO" | grep -Eo '[[:digit:]]+%' | tr -d "\%") -lt 80 ]] && systemctl poweroff
|
7
batt_check/batt_check.service
Normal file
7
batt_check/batt_check.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Battery Check Service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/local/bin/batt_check
|
8
batt_check/batt_check.timer
Normal file
8
batt_check/batt_check.timer
Normal file
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Check the battery status and shutdown if discharging and low
|
||||
|
||||
[Timer]
|
||||
OnActiveSec=120
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user