my @time = localtime; $control->log("Starting Curtain Controller") if $DEBUG > 1; # Check Pi has valid time if ($time[5] + 1900 < 2020) { my $restart = $local_conf->key('RESTART COUNT'); if ($restart > 15) { $control->log("Still no valid time - rebooting!"); $local_conf->key('RESTART_COUNT', '0'); sleep 2; system("reboot"); exit 0; } $control->log("No valid time is set - exit $restart"); $restart++; $local_conf->key('RESTART_COUNT', $restart); exit 0; } $local_conf->key('RESTART_COUNT', '0');