#!/usr/bin/bash test -f /var/lib/.block-reboot && exit 0 # if reboots are blocked exit immediately /usr/bin/mythbackend --printsched | /usr/bin/grep -A2 "print list start" | /usr/bin/grep "print list end" &> /dev/null if [ "$?" != "0" ]; then exit 0 # grep exiting 1 means there is at least one recording in the list, so do nothing fi sleep 180 # give the scheduler chance to schedule programs before we give up /usr/bin/mythbackend --printsched | /usr/bin/grep -A2 "print list start" | /usr/bin/grep "print list end" &> /dev/null if [ "$?" != "0" ]; then exit 0 # grep exiting 1 means there is at least one recording in the list, so do nothing fi /usr/bin/sudo /usr/sbin/shutdown -r 0 "No recordings in the schedule"