You are not logged in.
I have a seemingly simple problem, but there doesn't seem to be any simple solution.
I want to let my kids watch cartoons at bed time in Kodi.
However, they're learning to restart shows and end up staying up all night watching the TV and it's becoming a problem.
I'd like to find a solution that can stop the video and lock the computer at a preset time.
Ideally I'd like it to automatically unlock at a preset time.
Here are some solutions I've considered.
timeoutd - Is based on total screentime, not bed time
timekpr-next - Again based on total screentime, not bed time
Kodi Sleep Timer - Stops the video but doesn't disable restarting a video
cron or systemd/Timers - I can probably kill kodi and log out the user, but this requires manual intervention the next day to make it usable for the kids.
Currently the kids computer is password protected which would prevent them from just logging back in after it logs out.
Can anyone suggest a possible solution?
I just want the computer disabled during a preset time frame, ideally keeping the user logged in so they can put cartoons on in the morning.
I'm trying to teach them some independence and I want them to have freedom exploring the computer, but I can't have my sleep disrupted every night.
Thank you.
Last edited by heidegger (2020-08-09 16:11:18)
Offline
Where are the cartoons hosted? If they are Internet based, how about blocking them at the router? Many consumer type routers already have time of day triggered firewall rules in place.
You could also use the 'at' command to schedule changes to the firewall on their machine. Add rules to block internet access at bedtime, and unlock access at the end of homework time tomorrow.
Or (as a father of two myself), get rid of the TV
Last edited by ewaller (2020-08-08 16:19:29)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Thanks for the quick reply.
These videos are on the local machine so firewall rules won't likely help.
But I could consider hosting the files on an nfs share, then setting a firewall rule.
I have stored them locally though, as the wifi is spotty and creates disconnection issues.
You may be right about getting rid of the TV, but that's a whole other struggle.
Offline
How about a bind mount? Leave the videos local, but point Kodi at a mount point that is empty. During cartoon hours, bind mount the directory containing the videos to the mount point. Unmount them automatically at bed time.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Thanks! This could work.
I will work through the details of setting this up using systemd/Timers and return with the results.
Let me know if you think cron or another solution is a better avenue.
Offline
cronjob to kill kodi and run eg. slock, another cronjob to kill slock and start kodi.
rtcwake in between (so the thing isn't running all night)
I will point out that I used a flashlight to read under the sheets… if you want the kids to sleep, make them squat heavy before bedtime (knocks me out reliably ;-)
Offline
ewaller or anyone: So I think I have a proper stop timer and service set up for systemd however, I'm concerned that mount and umount require root privileges. Will these systemd services execute these commands properly using sudo systemctl start/enable ...?
seth: I appreciate your suggestion, I'm already headed down the systemd route so I'll give it a shot if I fail. I'll be honest it sounds easier but we're supposed to be accepting systemd now right?
Offline
So here's where I am...
I have created .service and .timer files as follows:
##movies-stop.timer
[Unit]
Description=Disable Kids Movies at 10PM
[Timer]
OnCalendar=*-*-* 22:00:00
Persistent=true
[Install]
WantedBy=timers.target
##movies-stop.service
[Unit]
Description=Stop Kodi Local Videos
[Service]
Type=simple
ExecStart=umount -l /home/tbd/Movies_Kodi
[Install]
WantedBy=multi-user.target
##movies-start.timer
[Unit]
Description=Enable Kids Movies at 08:00AM
[Timer]
OnCalendar=*-*-* 08:00:00
Persistent=true
[Install]
WantedBy=timers.target
##movies-start.service
[Unit]
Description=Start Kodi Local Videos
[Service]
Type=simple
ExecStart=mount --bind /home/tbd/Movies_Laptop /home/tbd/Movies_Kodi
[Install]
WantedBy=multi-user.target
I appreciate any knowledge about why this may or may not work.
So far I seem to be able to make the Movies_Kodi folder readable/unreadable by starting either movies-start or movies-stop service.
I hope the timers work as expected.
And in case anyone is reading this for future reference, Kodi seems to preload the entire movie, so stopping at 10PM means that any running movie will finish but no new movies can be started after 10PM.
So I have had success starting and stopping the services manually.
I have enabled the timers, although I am completely new to them and may be doing it wrong, who knows.
Thanks,
-H
Last edited by heidegger (2020-08-09 01:30:22)
Offline
Just a quick follow up.
This method using the above systemd timers and bind mounts seems to work just fine for my needs.
Thanks for your help!
-H
Last edited by heidegger (2020-08-09 16:10:53)
Offline