[Unit]
Description=Update acpid, as to whether or not the power is on[Service]
Type=oneshot
ExecStart=/usr/local/sbin/acpidpwr-update[Install]
WantedBy=multi-user.target
to /etc/systemd/system
and a hook:
if [ "$1" = "post" ]
then
acpidpwr-update
batlife -s
fi
to /usr/lib/systemd/system-sleep/
Where acpidpwr-update is just a script that uses acpi to determine whether or not the power cord is plugged in, and call /etc/acpi/handler.sh as to emulate a plug/unplug event.
#!/bin/bash
if [[ $(acpi -a | grep on) ]]
then
onBit=1
else
onBit=0
fi
/etc/acpi/handler.sh ac_adapter AC a 0000000$onBit #the 'a' is garbage
sudo /etc/rc.d/acpid stop && sleep 2 && sudo /etc/rc.d/acpid start
Also if I start it with rc.d like this:
sudo rc.d restart acpid
acpid also refuses to load any custom rules.
I have no idea why this line isnt working but since it works if I start it with the line above I really didnt care much to find out why.
Yeah I'm kinda lazy but I hope I helped you out with this. Atleast a little bit.
I hope I'm making sense?
]]>sudo /etc/rc.d/acpid restart
sudo /etc/acpi/handler.sh ac_adapter AC a 00000000
But it'd be great if I didn't have to.
]]>