#!/bin/sh TRG=/tmp/shutdown.screensaver date -d "+1 hour" +"%s" > "$TRG" while true; do now=$(date +"%s") [ -f "$TRG" ] || break trg=$(cat "$TRG") if [ "$now" -ge "$trg" ]; then shutdown -h now rm "$TRG" fi sleep 5 done