#!/bin/sh # This turns on the power LED when there's outgoing mail # in the Postfix queue, and turns it off when there's no # mail. After boot the "outgoing mail" (power) LED is # on until the script runs the first time. LED=/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness setled() { [ -e $LED ] && echo "echo $1 > $LED" | sudo sh } if mailq | grep -q 'Request' || \ ps -u $LOGNAME -o command | \ grep -q '^/usr/bin/python /usr/bin/offlineimap'; then setled 1 else setled 0 fi