A while back I presented a solution to a pretty icky problem - how to test for intermittent power issues. Here's a slightly improved version of that script. It keeps the machine on for 2 minutes before shutting down and also keeps an activity log. The delay is also used as the power on interval.
if [[ $USER != "root" ]]; then echo "This must be run as root" exit 1 fi ROOTPW="1234" DELAY=120 LOGFILE=~/Desktop/poweron.command.log osascript -e "delay $DELAY" TIMESTAMP=$(php -r "echo date ('H:i:s"', time() + $DELAY);") echo $ROOTPW | sudo -S pmset repeat poweron MTWRFSU $TIMESTAMP echo -n $(date "+%d.%m.%y @ %H:%I:%S") >> $LOGFILE echo " " $(wc -l $LOGFILE) >> $LOGFILE osascript -e "tell application "Finder" to shut down" exit 0