mirror of https://github.com/captn3m0/Scripts.git
Fix DBUS issue with cron
This commit is contained in:
parent
ba3b566b01
commit
37830a86b3
|
@ -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%"
|
||||
|
||||
|
|
Loading…
Reference in New Issue