Needs Help With Starting Ngrok In Background Automaticly At Boot

  • hello everyone, i have raspberry pi 4 with libreElec OS , i have installed ngrok, and i want to run ngrok at startup in background.

    howTo do this? /shrug

    libreelec v19.5 stable

    v10.0.4

    RPi4.arm

    any information missing? let me know ^^

  • ngrok would probably have dependencies on networking so systemd would always be the better approach since you can sequence the start to happen after the network is up/online.

  • so if i want to add this at startup

    ./ngrok tcp 22

    i would create a file in system.d folder

    name it ngrok.service.tunnel

    now what do i input in this file? only the command like this?:

    ./ngrok tcp 22

    and keep the rest of the file empty?

    or i need more information?

    after this i would do a reboot and it would start automaticly at every boot unless i do upgrade/downgrade OS?

    thanks you all for helping :D

  • ^ something like that in /storage/.config/system.d/ngrok.service

    Then "systemctl enable /storage/.config/system.d/ngrok.service" and "systemctl start ngrok.service" .. it should then be persistent over restarts and even upgrades (as long as ngrok itself continues to run).

  • this is my ngrok.service file:

    ------

    [Unit]

    Description=ngroc service

    After=network-online.target nss-lookup.target time-sync.target

    Wants=network-online.target nss-lookup.target time-sync.target

    [Service]

    Type=oneshot

    RemainAfterExit=yes

    ExecStart=/storage/ngrok tcp 22

    [Install]

    WantedBy=multi-user.target

    ------

    Any more info i need to edit?

    see image for error:

    i got this new folder named multi-user.target.wants containing the link to ngrok.service

    i tried running systemctl status ngrok.service but the output was too much for my ssh client on my iphone.

    thanks for all help ;)

    why image error didnt show earlier:

    i think i added attachment from photos and then i choose full image so it appeared in my comment and then i deleted the attachment because i tough the attachment and full image would mean double images..