Systemd: Hidden Gems for a Better Linux
tadeubento.com
external-link
Systemd is incredibly versatile and most people, including myself, are unaware of its full potential. Despite its usefulness, it is often overlooked due to controversy and the current state of things when it comes to software development. Begin today your journey thought Systemd's capabilities and discover how to efficiently manage systems with fewer processes than traditionally used.

After a few conversations with people on Lemmy and other places it became clear to me that most aren’t aware of what it can do and how much more robust it is compared to the usual “jankiness” we’re used to.

In this article I highlight less known features and give out a few practice examples on how to leverage Systemd to remove tons of redundant packages and processes.

And yes, Systemd does containers. :)

Atemu
link
fedilink
English
21Y

My only complaint is it’s a bit verbose. I’d rather have it as an option inside the .service file. The .timer requires some boilerplate like [Unit].description (it… uh… triggers a service. that’s the description), and WantedBy=timers.target.

This can be solved through abstraction and automation.

In NixOS for example, you can declare a service that runs an arbitrary script every day like this:

{
  systemd.services.your-service-here = {
    script = "echo 'Hello, world!'";
    startAt = "daily";
  };
}

This automatically creates a service file with the script in its ExecStart and an accompanying timer which runs daily and is part of the timers.target.

@maor@lemmy.org.il
link
fedilink
English
21Y

Yep, I manage my servers and local machine with Ansible so I abstracted it with a role. This is indeed not that bad of a con because it’s still plaintext so automation is easy, but it’s still a minor issue ;)

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 136 users / day
  • 427 users / week
  • 1.16K users / month
  • 3.85K users / 6 months
  • 1 subscriber
  • 3.68K Posts
  • 74.2K Comments
  • Modlog