Your best option is to restore from your backup.
If your Pi won't boot you can repair by rebooting to a root shell.
Append init=/bin/sh at the end of cmdline.txt (which can be done on any computer) and reboot.
After booting you will be at the prompt in a root shell.
Your root file system is mounted as readonly now, so remount it as read/write mount -n -o ...
Have you tried cron?
Assuming you can run the script from the terminal, as user pi (i.e. No sudo required), and it runs correctly:
From the terminal (CLI; don't enter the $ in column 1 - it's the shell prompt):
$ crontab -e
You may be prompted to choose an editor for your crontab; nano or pico are reasonable choices if you're not familiar with the other ...
Fortunately this worked. Unfortunately, I don't know which one worked. I tried a but of each along whit what was here https://www.raspberrypi.org/documentation/configuration/config-txt/video.md and the problem is fixed now.
You can install a momentary push button to one of the GPIO pings then add the line dtoverlay=gpio-shutdown to /boot/config.txt on your Pi.
It will shutdown the Pi but it will consume a small amount of power, about 35 mA,
when in this state.
You can also press the button to power up the Pi afterwards. The default is pin 5 and ground but it can be changed.
The Raspberrypi doesn't have a power button, if thats what you're asking.
You could Use a powerstrip with a switch. But make sure to always shut down your raspberry completely bevore toggling the switch, to preserve your SD card.
Or if you would consider adding a button nontheless, maybe you wan't to buy something like the pimoroni onoff shim ?
I have no ...
RPi 4B 5V Power Bus
AFAIK, there is no command, dtoverlay, or bootloader configuration that will power off the 5V output on the RPi 4. Using WAKE_ON_GPIO=0 and POWER_OFF_ON_HALT=1 in the bootloader configuration will place the RPi 4 in a low power mode upon halt shutdown or poweroff. In this low power mode the RPi's power consumption is reduced to ...
I have used gpio-shutdown to implement a shutdown button. See https://raspberrypi.stackexchange.com/a/77918/8697
The ONLY was to reboot if you have POWER_OFF_ON_HALT=1 is to cycle power or pull the GLOBAL_EN pin LOW.
The GLOBAL_EN pin is connected to the MxL7704 power management chip, and pulling this low should be similar to cycling power. See https://...
The technique suggested by Goldilocks should work, but the analysis always seemed unmanageable.
I applied this to a script I routinely use to search log files.
Basically this will show kernel logs, interspersed with systemd-timesyncd, which quite clearly shows when the system clock is changed.
May 27 15:52:30 MilliwaysPi3A kernel: [ 19.976079] ICMPv6: ...
By default rsyslog's startup messages should end up in /var/log/messages. They look like this:
May 27 08:24:55 raspberrypi rsyslogd: [origin software="rsyslogd" swVersion="8.1901.0" x-pid="319" x-info="https://www.rsyslog.com"] start
That's not from tomorrow ;) but by coincidence 364 days ago.
The unfortunate thing ...
last -x may show what you want.
last -F shows substantially the same, but with full times.
Normally boot would show time, but as the Pi has no clock this is useless.
runlevel (to lvl 5) is the first meaningful time on boot.
NOTE Even this may not give the full picture.
Shortly after boot the date/time is set to last known (by fake-hwclock) before NTP is ...
I'm not sure what error your are having, but check out this page for information about running programs on the rasrpberry pi on startup.