I'm trying to run a simple bash script that turns off my notebook if it is not pluged on AC with a cron job.
My script is as follows:
#!/bin/bash
if ! on_ac_power; then
poweroff
fi
And I've configured cron to run it every minute like so:
*/1 * * * * /home/user/Documents/script.sh
The script works just fine if I run it manually, but otherwise, it seems to have no effect under cron.
What am I missing here?