RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Getting a startup script to start?

    Scheduled Pinned Locked Moved Help and Support
    raspbian
    11 Posts 5 Posters 9.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      DJQuad
      last edited by

      Hey all, I'm trying to get a script started at boot. It doesn't start when added to crontab ("@reboot /usr/local/bin/start-script") at the bottom, nor does it by adding it to /etc/rc.local. It only starts if I start it manually and then it runs fine.

      Is there some sort of trick to getting scripts to run on a Raspberry Pi with RetroPie at boot?

      Note: I'm actually testing this on a Debian VM with Emulation Station.

      1 Reply Last reply Reply Quote 0
      • C
        CrazySpence
        last edited by

        rc.local should work are you putting & at the end so it goes in the background?

        i run a few things in rc.local works on wheezy and jessie without issue

        full path is also important when using rc.local

        in the file for example and if it's a bash script make sure it's got #!/bin/sh at the beginning of the file

        #!/bin/sh
        /usr/local/bin/start-script &

        Those are just a few things I can think of off the top of my head

        1 Reply Last reply Reply Quote 0
        • D
          DJQuad
          last edited by

          Thanks for the reply. Here's my rc.local -
          /usr/local/bin/start-video-screensaver &
          exit 0

          It's a Python script. Should I try putting this as the first line instead of #!/bin/sh?
          #!/usr/bin/env python2

          glennlakeG 1 Reply Last reply Reply Quote 0
          • C
            CrazySpence
            last edited by

            rc.local is a shell script so no you want #!/bin/sh in it

            in your python script though you should start it with the python line if it doesn't have it already

            or prefix the script with python /path/to/script

            1 Reply Last reply Reply Quote 0
            • glennlakeG
              glennlake @DJQuad
              last edited by

              @DJQuad I'm not sure if this will work but you may try just putting sudo at the start of each line you want to run. If is doesn't work it can just be deleted.:-)

              1 Reply Last reply Reply Quote 0
              • T
                tehswiftone
                last edited by

                This is how I got my python restart script to work.

                • Save script to /home/pi
                • Edit the /etc/rc.local file and add the following line ABOVE 'Exit 0'
                • python /home/pi/restart.py &
                1 Reply Last reply Reply Quote 0
                • D
                  DJQuad
                  last edited by DJQuad

                  Unfortunately no go. Can any of you please try it on an actual Pi preferably with RetroPie installed? The script is actually on GitHub at https://github.com/windweaver828/Video-Screensaver and the readme is at https://github.com/windweaver828/Video-Screensaver/blob/master/README.md

                  xautolock should be listed as a process if it's running and I also set the start time in the cfg to 1 minute.

                  BuZzB 1 Reply Last reply Reply Quote 0
                  • BuZzB
                    BuZz administrators @DJQuad
                    last edited by BuZz

                    @DJQuad That wont work with RetroPie. It is designed to be run under a desktop on X (it uses some X tools, but could be modified I guess to work without them).

                    To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                    1 Reply Last reply Reply Quote 1
                    • D
                      DJQuad
                      last edited by

                      Even though Omxplayer is used to play the videos?

                      1 Reply Last reply Reply Quote 0
                      • BuZzB
                        BuZz administrators
                        last edited by BuZz

                        Yes. It uses xautolock

                        http://linux.die.net/man/1/xautolock

                        The code would need changing to remove this dependency and use another method to trigger etc.

                        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                        1 Reply Last reply Reply Quote 0
                        • D
                          DJQuad
                          last edited by

                          Right but like I said, it runs just fine and as expected if it's started manually after a restart.

                          Perhaps turning it into a service would be better since it needs to be run as root?

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.