serman: simple ncurses-based systemd service file manager

Project page: http://xyne.archlinux.ca/projects/serman/Serman (service manager) is a simple ncurses-based systemd service manager. It provides an easy way to manage services with an overview of what is currently enabled, running, etc.

Serman2: Python curses rewrite

The package now includes a second executable named serman2. All of the service management functionality works but there are still a few gui bugs (mostly when reszing the window in text view). I'll sort that out soon. In the meantime, please test it and post feedback.

Screenshot of the new version

Screenshot of the old version

(There are more on the project page.)

Original Post

I wrote a simple script for basic dialog-based systemd service file management (enable/disable, start/stop). There's probably some much more robust, built-in way to do this with systemd but I didn't find it. Besides, I had just finished setting up systemd and writing netcfg-checklist, so curiosity got the best of me.

If this is useful it will likely be expanded and packaged. You can get serman here for now. See

serman -h

for options.

Caveats: I'm a systemd noob and this has not been extensively tested. That said, the script is simple and it should be safe unless you run it as root and play Russian roulette with the core services.

Re: serman: simple ncurses-based systemd service file manager

Rather than gradually duplicate multiple systemctl options, I have added a single option to pass remaining arguments to systemctl. I don't use systemd login sessions so I can't test it, but you should now be able to manage user services with "-a --user" at the end of the command. If it doesn't work, use the new "--dry-run" option, inspect the command, determine what is wrong with it, and let me know how to fix it.

Re: serman: simple ncurses-based systemd service file manager

Xyne wrote:

A python curses rewrite is on my todo list.

Well, that's mostly done now. I was just going to glance over the Python curses documentation but got sucked into programmer's limbo and ended up rewriting serman in a single session. The code needs some cleaning (one session + completely new to ncurses = suboptimal design but too too shabby for a first attempt) and there are still a few gui bugs* (but none in service management, at least not that I've found so far).

I have included the new version as "serman2" in the package. Please give it a try. You can see a screenshot in the OP (there's another one on the site).

Quickstart guide:serman2 --help shows the current options (minor changes)Run serman2 and press F1 to get to the help message.

Check the comments at the top of the file for more information. I'll fix any bugs in service management as soon as I become aware of them (not expecting any though, because it's the same code as the original serman). I don't want to deal with curses resizing errors any time soon, Maybe it's just because I'm ridiculously tired, but the geometry management remains a black art to me at this point.*

Enjoy!

* If you shrink the help message window horizontally, it doesn't update, but shrinking it vertically or expanding in any direction works as expected. I think the problem is that each time it is shrunk, a character is written outside of the allocated horizontal space, but I just can't for the life of me figure out what I need to adjust. Again, I'm ridiculously tired so probably missing something simple, but it just makes no sense to me and the fscking "ERR" error messages don't help.

Re: serman: simple ncurses-based systemd service file manager

Then have a nice and healthy sleep!!

To quit serman2, which works with Ctrl+c, I expected something like 'q'. Would be more consistent with other cli apps imo. And maybe include vim-like navigation (hjkl, gg, G)? Don't know if I'll ever need this, but it sure looks nice

Re: serman: simple ncurses-based systemd service file manager

Xyne wrote:

also, not using my repo

I know you have a repo, but your stuff tends to be just scripts, so because I only take a few things here and there from your contributions, I figure using the AUR for your stuff with the zero compile time it takes is not such a hassle...

Edit: Okay, its working, and its real purdy... though I have noticed two things I figured I should report back to you. One is that it doesn't seem to handle the @ services. Like netctl-auto@.service is indeed active as netctl-auto@wlan0.service. Also it would be nice with some vi keybindings

Re: serman: simple ncurses-based systemd service file manager

@Army & @WonderWoofyI bound q at first, but then I made it possible to jump to characters in lists by typing them. Maybe I'll rework it later to use meta keys (maybe alt?). The same considerations apply for vim key bindings. I plan to make it configurable in any case but I want to give it some thought first. The easiest way will be to dump all the colors, symbols, status messages and binds in a JSON file and let the user configure that however he wants.

I'm looking at a minor bug in service detection right now. I noticed that it effectively filters some of them.

Re: serman: simple ncurses-based systemd service file manager

This is great - I'm loving serman2. Is there a way to go back to the "default" view though from the F1/F2 displays? Right now I can't find anyway to do so but to Ctrl-C then restart serman2. Also, I'm currently getting a blank screen with F2 on any service, but this may be due to permissions issues with systemd-journal which I've never gotten around to setting up properly.