• thingsiplay@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    9 hours ago

    Is there a way to limit download bandwidth of programs started with this systemd-run command? Without changing some network settings, I just want to do it temporarily on the fly with commandline options.

      • thingsiplay@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        6 hours ago

        That’s not the same as network bandwidth. Maybe I used the wrong terminology, I meant download speed, not max downloaded size of data contingent.

        • Magiilaro@feddit.org
          link
          fedilink
          arrow-up
          2
          ·
          6 hours ago

          Yes and as I said there is no way to limit the network bandwidth, as far as I know, but limiting the speed that the tool can write to the storage device oftentimes limits the speed of retrieval also.

          Kind of a indirect speed limit for the download, as a workaround.

          • thingsiplay@lemmy.ml
            link
            fedilink
            arrow-up
            2
            ·
            5 hours ago

            Ah, I didn’t pick up on that. Well, need to test this out. As a workaround it could work. I don’t have any other special requirements for this, its really a workaround in itself for tools that don’t have this setting. (which annoys me alot) Nice idea btw.

        • badmin@lemmy.today
          link
          fedilink
          arrow-up
          2
          ·
          6 hours ago

          There is an ancient fully user-space simple tool called netbrake that works by LD_PRELOADING a library that overrides some functions like recv/sendto (similar to eatmydata’s approach*). It may just work if you don’t have special requirements. If you’re curious, you can see the full list of overridden symbols with:

          readelf -s /path/to/libnetbrake.so | grep -v UND
          

          If you want a possibly fail-safe (kernel level) solution, you may find with a web search a helpful approach combining tc with cgroups.

          Neither solutions need systemd.


          * The realization that people growing up with SSD’s probably never heard of eatmydata just sunk in.

          • thingsiplay@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            6 hours ago

            Thanks for the tip. I will look into it. My use case would be to limit download speed for applications that do not have such a setting (such as Firefox, just an example).

            • badmin@lemmy.today
              link
              fedilink
              arrow-up
              1
              ·
              5 hours ago

              such as Firefox

              You can use the cliget extension which generates full CLI commands for major CLI tools. Such tools have many options (e.g. curl’s --rate-limit).

              • thingsiplay@lemmy.ml
                link
                fedilink
                arrow-up
                1
                ·
                5 hours ago

                Firefox was just one example of tool that doesn’t provide a limit by itself. I’m looking for a solution that could be applied to any program.