I’d like to disable some services that might decrease my gaming performance while a game is running. Stuff like search indexing, automatic updates, filesystem tasks.

Has anyone done something in that direction?

My spontaneous idea was to use gamemode to switch to a systemd target that disables those services. Although I’m not sure if systemd targets actually can disable services or if they can only start them. Might also be a little overengineered.

If I don’t get a better idea I will just run a start and stop script with gamemode to handle all that. Although I’m not sure if that would be able to stop system services. Will cross that bridge when I get there.

Edit: While I can automatically stop services by starting a target they aren’t started again after stopping the target. I guess I will just use some simple start-gaming and stop-gaming scripts.

  • Max@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    8 hours ago

    I think if you switch back to the original target that depends on those services they should start again?

    Like systemctl isolate yourtarget.target and then a systemctl isolate graphical.target to return to normal operation

    Isolate will stop any services that aren’t required by the dependency chain.

    Some of these might be user services though, in which case you’d need to create a user target

    It’s possible that you don’t need to use isolate though, and can just start a target that conflicts and then instead of stopping it, start graphical.target

    • Björn TantauOPA
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      8 hours ago

      Yes, you’re right!

      In my case starting timers.target stops my gaming.target and restarts all the timers gaming.target had stopped.

      Edit: I don’t want to use isolate because I’d rather blacklist the services I don’t want.

      • Max@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 hours ago

        Sorry for the series of edits. Yeah, just starting timers.target or graphical.target again when you’re done without using isolate seems like a pretty good strategy!