Fix DBUS issue with cron

This commit is contained in:
Nemo 2019-04-12 01:47:03 +05:30
parent ba3b566b01
commit 37830a86b3
1 changed files with 2 additions and 3 deletions

View File

@ -1,13 +1,12 @@
#!/bin/bash
# Add the following to your crontab to get this working
# DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
# XAUTHORITY=/home/nemo/.Xauthority
BATTINFO=`acpi -b`
BATTERY=/sys/class/power_supply/BAT0
REM=`grep "POWER_SUPPLY_CHARGE_NOW" $BATTERY/uevent | awk -F= '{ print $2 }'`
FULL=`grep "POWER_SUPPLY_CHARGE_FULL_DESIGN" $BATTERY/uevent | awk -F= '{ print $2 }'`
PERCENT=`echo $(( $REM * 100 / $FULL ))`
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XAUTHORITY=/home/nemo/.Xauthority
echo "Battery is at $PERCENT%"