add powersave script

This commit is contained in:
Inhji 2023-09-06 07:07:34 +02:00
parent c4f6b8b4d0
commit 315a82eac3
1 changed files with 41 additions and 0 deletions

41
config/scripts/powersave.sh Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
#
# MNT Reform Powersave Script
#
if [ "on" = "$1" ]; then
echo "Turning Powersave ON.."
echo "Stopping Syncthing.."
systemctl --user stop syncthing
echo "Stopping Bluetooth.."
sudo systemctl stop bluetooth
echo "Stopping Wifi"
sudo systemctl stop wpa_supplicant
elif [ "off" = "$1" ]; then
echo "Turning Powersave OFF.."
echo "Starting Syncthing.."
systemctl --user start syncthing
echo "Starting Bluetooth.."
sudo systemctl start bluetooth
echo "Starting Wifi.."
sudo systemctl start wpa_supplicant
else
echo "MNT Reform Powersave Script"
echo "----------------------------"
echo "Bluetooth: `systemctl is-active bluetooth` (`systemctl is-enabled bluetooth`)"
echo "Wifi: `systemctl is-active wpa_supplicant` (`systemctl is-enabled wpa_supplicant`)"
echo "PostgreSQL: `systemctl is-active postgresql` (`systemctl is-enabled postgresql`)"
echo "Syncthing: `systemctl --user is-active syncthing` (`systemctl --user is-enabled syncthing`)"
echo "----------------------------"
echo "Usage:"
echo " powersave off"
echo " powersave on"
fi