3

I have installed steam link in raspbian stretch, but I would like it to start when the operating system starts, I've been reading and I tried it with init.d but it did not work for me.

Thank you.

4

/etc/init.d was deprecated with Jessie. Everything is done with systemd now on Raspbian Stretch (and lots of other distros).

There's six places where you can easily get things running at boot time.

  1. Add a line to /etc/rc.local with sudo nano /etc/rc.local. Add your program before the exit 0 line. Put an & on the end of the line if it starts a long running process.
  2. Add an @reboot line to your personal crontab with crontab -e
  3. Add an @reboot line to root's crontab with sudo crontab -e
  4. Add a cron line in /etc/crontab (not recommended).
  5. Add a line to your autostart file in /home/pi/.config/lxsession/LXDE-pi/autostart which looks like @/usr/bin/python3 /home/pi/thing_to_start.py
  6. Create a systemd service file in /etc/systemd/system/myscript.service which has this basic structure

    [Unit]
    Description=Thing to start at boot time
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 /home/pi/thing_to_start.py
    
    [Install]
    WantedBy=multi-user.target
    

There are other ways to get things running but those are the six most popular. If the program you're starting uses the GUI use the autostart method.

  • 1
    For me, option 1 worked, but simply adding steamlink wasn't enough. I needed to run as the pi user: su - pi -c steamlink – HotN Mar 30 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.