I think there are multiple things one could do to achieve this, but am uncertain which way to go:

  • if you use systemd create a systemd service I guess? How to create systemd service that runs a (python) script on startup?
  • some files similar to .bashrc always run on system startup/boot?; use this if you are less fancy / have no systemd
  • Possibly linux@lemmy.zipM
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    12 hours ago

    What do you want to accomplish? Systemd can do lots of things like monitoring, sandboxing and dependency management along with just running commands.

    If you are on a Busybox init based system like OpenWRT you can also just write a init script.

    • helloworld@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 hours ago

      My first simple use case: I want to start a http (busybox httpd) server on localhost inside a certain directory whenever I turn the PC on.

      • Possibly linux@lemmy.zipM
        link
        fedilink
        English
        arrow-up
        2
        ·
        12 hours ago

        Don’t use a script for this

        I would setup Lighttpd since it is a proper server while being pretty lightweight. It should come with the needed systemd unit so that you can just do sudo systemctl start lighttpd

        Avoid writing scripts like the plague. Config files are much better and will scale better.