From b3297f86a6b26916a6498efcff3023244833cc86 Mon Sep 17 00:00:00 2001 From: Andreas Hrubak Date: Mon, 11 Nov 2024 21:11:51 +0100 Subject: [PATCH] dont run anything if mains is on-line --- admin-tools/check-battery | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/admin-tools/check-battery b/admin-tools/check-battery index 88cd810..0e8add6 100755 --- a/admin-tools/check-battery +++ b/admin-tools/check-battery @@ -30,9 +30,15 @@ $highest_remaining_sec = undef; $highest_percent = undef; -open my $pipe, '-|', 'acpi', '-b' or die "$0: $!"; +open my $pipe, '-|', 'acpi', '-ab' or die "$0: $!"; while(<$pipe>) { + chomp; + if(/Adapter.*on-line/) + { + warn "$0: $_: No action.\n"; + exit 0; + } if(/(\d\d+):(\d\d):(\d\d) remaining/) { my ($hour, $min, $sec) = ($1, $2, $3); -- 2.11.4.GIT