From cbcfa80da84810beb34d56a953fc9cf7000c0b6f Mon Sep 17 00:00:00 2001 From: dataprolet Date: Wed, 17 Apr 2024 12:07:03 +0000 Subject: [PATCH] Initial commit --- Scripts/check_bat.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Scripts/check_bat.sh diff --git a/Scripts/check_bat.sh b/Scripts/check_bat.sh new file mode 100644 index 0000000..019c903 --- /dev/null +++ b/Scripts/check_bat.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Check if system is charging or not. +# Continue only if charging. + +on_power=$(cat /sys/class/power_supply/AC/online) + +if [[ $on_power == 0 ]]; then + echo "Device is not connected to power. Exiting.." + exit 0 +else + echo "Device is connected to power. Continuing.." +fi