]> git.sthu.org Git - shutils.git/commitdiff
systemd: Update battery script
authorStefan Huber <shuber@sthu.org>
Thu, 2 Apr 2026 10:10:21 +0000 (12:10 +0200)
committerStefan Huber <shuber@sthu.org>
Thu, 16 Apr 2026 09:15:34 +0000 (11:15 +0200)
systemd/usr/lib/systemd/system-sleep/battery

index 778bbd61866a1f3c074473197ef1a25ecec3b1e5..a16fb1a681bb444880f0249b9faf94b3d63a7693 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Stefan Huber, 2024-11-10
 
 acpi=$(acpi)
@@ -6,7 +6,7 @@ date=$(date -Iseconds --utc)
 addendum="."
 
 if [ "$1" = "post" ]; then
-    lastpre=$(grep pre /var/log/batterstat.log | tail -n1)
+    lastpre=$(grep "pre:" /var/log/batterstat.log | tail -n1)
 
     if [  ! -z "${lastpre}" ]; then
         prepercent=$(echo "${lastpre}" | grep -o "[0-9]*%" | cut -f1 -d%)