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
|
@ -19,7 +19,7 @@ start() {
|
||||
echo "Server already running with pid: $(cat $PID)"
|
||||
status
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
screen -S minecraft -dm java -Xms1G -Xmx5G -jar /opt/minecraft/server.jar nogui
|
||||
pgrep -P "$(screen -list | sed -E -n 's/\s*([0-9]+).minecraft.*/\1/p')" > $PID
|
||||
}
|
||||
|
Reference in New Issue
Block a user