You are not logged in.

#1 2024-07-16 16:47:31

coldreactive
Member
Registered: 2024-07-04
Posts: 15

[SOLVED] Creating a sysd file to run service from the HOME Directory?

I want to create a systemd service that runs this file: https://gitlab.com/XenHat/dotfiles/-/bl … pc_service

But the file will be placed somewhere in the user's home directory. So I have this so far:

[Unit]
Description=Discord Rich Presence Service for FFXIV

[Service]
ExecStart=

And don't know what the systemd is expecting to reference where the user's home directory is. is it $HOME like in bash? Or what? Also, once the file is written, should I put it in /etc/systemd and use systemctl enable like normal?

Last edited by coldreactive (2024-07-16 18:58:17)

Offline

#2 2024-07-16 16:58:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,910

Re: [SOLVED] Creating a sysd file to run service from the HOME Directory?

You want this to be invoked as a user service and not a system service. https://wiki.archlinux.org/title/Systemd/User

As a user service you can use %h to refer to your home directory. in the unit file, so e.g.

[Unit]
Description=Discord Rich Presence Service for FFXIV

[Service]
Type=simple
ExecStart=%h/scripts/ffxiv_rpc

[Install]
WantedBy=default.target

Last edited by V1del (2024-07-16 17:01:28)

Offline

#3 2024-07-16 17:35:32

coldreactive
Member
Registered: 2024-07-04
Posts: 15

Re: [SOLVED] Creating a sysd file to run service from the HOME Directory?

Thanks, so I just put that text into ~/.config/systemd/user/ffxiv_rpc.service?

Then run systemctl --user enable ffxiv_rpc?

Offline

#4 2024-07-16 18:53:12

ua4000
Member
Registered: 2015-10-14
Posts: 479

Re: [SOLVED] Creating a sysd file to run service from the HOME Directory?

Yes, I think so.

And as like system units you can inspect user units similar, if they are running ok, and what the log says:

systemctl --user status ffxiv_rpc.service
journalctl --user-unit ffxiv_rpc.service

Edit:
and for immediate start while your are in testing phase:

systemctl --user start ffxiv_rpc.service

Last edited by ua4000 (2024-07-16 18:56:22)

Offline

Board footer

Powered by FluxBB