My OSMC running on Pi2 is for showing ads and it uses autoexec.py to load a video dir and repeat forever.
I would like to make it sleep at nights and maybe also on weekends. How would I do that?
Do you advise doing a reboot in the mornings? Or simply use an electrical timer to cut power? Is the latter dangerous?
EDIT:
I am thinking using Cron to kill kodi and tvservice in the evenings and starting them in the mornings. Anything else worthwhile to kill? Perhaps a reboot in the morning instead of starting services again?
I think crontab is the way to go here, Iâve ran countless game servers and with cron i was doing all the stop/update/restart things. If your autoexec.py is working properly then i would suggest a reboot as well. Just dont forget to disable automatic updates in osmc, at least the manual selection that âwaitsâ for user interactionâŚyou dont want a popup showing on your screen
If iâm not mistaken its, apt-get install cron, not crontab.
Now I have a problem that when the HDMI is turned off - Raspberry wont restart - it crashes. Could it be logged somewhere? journalctl only knows that happened after boot. I added something after shutdown in cron but itâs not run anymore and I had to powercycle to have it resume operation.
Also since the shutdown -r now failed it will try again after power-cycling and it works then with HDMI on.
I could probably run tvservice -p before and it should work but thats hardly elegant, is it?
EDIT: I added âsystemctl stop mediacenterâ in between and while kodi.bin is still alive after the cron - restart now works!
EDIT2: Sadly the Pi RTC doesnât tick. It shows up as a hwclock but once its powered off for more than 10 minutes the time stops. It starts with the previous time. Any ideas?
EDIT3: I think I got itâŚwill leave it without power over night and then post my findings.
On workday evenings it stops first HDMI output (putting the monitor to standby) and then kills Kodi. In the morning it simply restarts and loads my autoexec.py to automatically start playing a folder of videos on repeat.
Then for the RTC I also needed the following:
And lastly to make it sync hwclock with system time at boot add to /etc/rc.local:
The restart is still not consistent. It sometimes works and sometimes it hangs requiring manual power cycling. Can anyone please help me get relevant logs?
I can make the restart work by running âtvservice -pâ (turning HDMI back on) at the same time as âshutdown -r nowâ but Iâd rather not use that.
EDIT: nope - nothing really helps - âshutdown -r nowâ hangs every now and then and I have to power cycle manually.
EDIT2: I am now running systemctl start mediacenter instead of the reset. Lets see how it holds up running by itself OVER THE YEARS
Well, unless the timer has a battery backup - you will drift back in time every time there is an outage. Also youâd still want to at least unmount the file systems to avoid data corruption. But still yes, it could work years this way