I'd like to write a shell script to do stuff only if I'm on AC and not running just on battery power. I checked dcop, I thought there might be something in klaptop, but there was nothing. I thought there might be something I could use in /proc but I got lost really quickly. Searches were all too general.

Has anyone ever written a shell script that has to do with this?

If anyone's wondering, I want to make a cronjob to start setiathome every night, but only if I'm plugged into the wall. I don't need to kill my battery looking for aliens