Darac Marjal <lists-debian-u...@bendel.debian.org> wrote:
> I'm not saying that what you did was wrong, but systemd provides a
> few shortcuts which can make things a bit more user-friendly.
> 
> On 16/07/2024 04:39, Greg Wooledge wrote:
> > OK. Let's follow this path a bit.
> > I googled "how to create a systemd user service" and got
> > <https://blog.victormendonca.com/2018/05/14/creating-a-simple-systemd-user-service/>.
> >
> > Starting from there:
> >
> > hobbit:~$ cd .config
> > hobbit:~/.config$ mkdir -p systemd/user
> > hobbit:~/.config$ vi systemd/user/xterm.service
> > hobbit:~/.config$ cat systemd/user/xterm.service
> > [Unit]
> > Description=Try to run an xterm
> >
> > [Service]
> > Type=simple
> > StandardOutput=journal
> > ExecStart=/usr/bin/xterm
> >
> > [Install]
> > WantedBy=default.target  
> 
> I think the systemd shortcut here is "systemctl --user edit 
> xterm.service". Now, "systemctl edit" usually edits an "override"
> file (allowing you to override settings supplied by the OS, you can
> edit the service file directly by adding the "--full" option. And, if
> you are creating a new service you tend to have to add "--force". So,
> the most reliable command for editing a user command would be
> "systemctl --user edit --force --full xterm.service".
> 
> One advantage of using "systemctl edit" rather than simply "$EDITOR"
> is that "systemctl edit" will perform a daemon-reload upon exiting
> the editor. That is, "systemctl edit" makes systemd aware of the
> changes.
> 
> > hobbit:~/.config$ systemctl --user enable xterm.service
> > Created
> > symlink /home/greg/.config/systemd/user/default.target.wants/xterm.service
> > → /home/greg/.config/systemd/user/xterm.service. hobbit:~/.config$
> > systemctl --user start xterm.service  
> 
> You can combine "enable" and "start" into a single command by adding 
> "--now" to the enable command, thus: "systemctl --user enable --now 
> xterm.service".

Increasingly systemd reminds me of SMIT (the system management part of
AIX). Designed to simplify complicated system management scripts by
using multiple short scripts, it just resulted in thousands and
thousands of system management scripts to manage :(

Reply via email to