How to delay startup of a program on boot

Discussion in 'Linux/BSD/Free Systems' started by Ej24, May 2, 2019.

  1. Ej24

    Ej24 Gawd

    Messages:
    589
    Joined:
    Jun 11, 2016
    I'm having an issue with a remote desktop streamer. It's set to run on startup, but it seems it's too quick and is running before my network connection is established so it throws an error and fails to start the program. So I'm always having to manually go start the software, not ideal.

    I tried adding the sleep command before the startup command so,
    Code:
    sleep 30; python /opt/splashtop-streamer/SRStreamer.pyc
    But then it just never runs the program. Not sure why. Anyone have any suggestions on how to run this program on startup but delay it for like 30 seconds?
     
  2. Ej24

    Ej24 Gawd

    Messages:
    589
    Joined:
    Jun 11, 2016
    So am I to add something like the following...
    Code:
    [Unit]
    Wants=network-online.target
    After=network-online.target
    to the .desktop file found here?
    Code:
    ~/.config/autostart/SplashtopStreamer.desktop
    which currently looks like
    Code:
    [Desktop Entry]
    Name=Splashtop Streamer
    GenericName=Splashtop Streamer
    Comment=Remotely access your desktop from any device from anywhere!
    Exec=python /opt/splashtop-streamer/SRStreamer.pyc
    Type=Application
    Icon=/opt/splashtop-streamer/SplashtopStreamer.png
    Categories=Network;
    Forgive my ignorance, I'm learning but my knowledge of Linux and the terminal is just enough to basically cd my way around some directories and copy and paste commands for now.
     
  3. ThatITGuy

    ThatITGuy Limp Gawd

    Messages:
    196
    Joined:
    May 5, 2017
    Still a bit new to this piece as well, but I would say no. You would want to change the sequence number the system has for it, but i think the linked article walks you through making sure the networking piece is triggered first,and then scripts are started from there. I know of update-rc.d for changing sequence, but if all scripts launch before networking, it doesn't help.
     
  4. FNtastic

    FNtastic [H]ard|Gawd

    Messages:
    1,337
    Joined:
    Jul 6, 2013