Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Auto Reboot

digitalfixerdigitalfixer Members, Plex Pass Posts: 52 Plex Pass
edited August 13 in Rasplex

I have my Rasplex Pi plugged into my avr with hdmi which is the connected to the tv with hdmi.

The problem is that on power on the avr and tv start on the wrong inputs and even if I change to the correct inputs I'm unable to control Rasplex with the remote.

If I login and reboot the Pi everything works normally after that.

What I'm hoping is that I can make a script to reboot the Pi about 30 seconds after first boot.

Kevin.

Comments

  • videotecaCNSUvideotecaCNSU Members, Plex Pass Posts: 265 Plex Pass

    Your problem its to differentiate a normal power on to a restart, because if not yor pi will be rebooting constantly
    So you cant save that variable to memory, you need to save it to a file and compare both dates on boot.

    So if the last check of the script to that file was less than 2 minutes ago dont reboot the pi, if it has been more than that then reboot

    you can probably do it with a bash script that touches a file and you compare dates but you can still have problems if the pi doesnt have internet to check the correct time online

  • digitalfixerdigitalfixer Members, Plex Pass Posts: 52 Plex Pass

    I have the logic worked out but my problem is where to insert a call to my script in the bootup sequence.

    Kevin

  • videotecaCNSUvideotecaCNSU Members, Plex Pass Posts: 265 Plex Pass

    in the autostart.sh you need to create inside /.config

    but if I were you what I would do is restarting the CEC service in some way from that script, that would be a more elegant way of handling it

  • videotecaCNSUvideotecaCNSU Members, Plex Pass Posts: 265 Plex Pass
    edited August 15

    Try this, but to be fair there must be a way to restart just that service or maybe without the & we could add a sleep and freeze the entire system the time you need before the boot system continues

    #!/bin/sh
    (sleep 30s;
    systemctl restart kodi;) &
    

    Im sure there are more elegant ways to do it but I really dont know how the cec service works and I dont have a compatible tv to test it

  • digitalfixerdigitalfixer Members, Plex Pass Posts: 52 Plex Pass

    Thank you for pointing me in the right direction. Working fine now.

    Kevin

  • videotecaCNSUvideotecaCNSU Members, Plex Pass Posts: 265 Plex Pass

    You can also add

    boot_delay=x

    in the config.txt to halt the entire system when it boots, thats probably an even better way

  • digitalfixerdigitalfixer Members, Plex Pass Posts: 52 Plex Pass

    I tried the boot_delay first but there was no cec until PHT had started.

    A 20 second sleep then reboot solved it.

    Kevin

Sign In or Register to comment.