Search code examples
linuxsystemdsystemctl

Can't access a non-root systemd service with systemctl


I'm a systemd newbie, apologies in advance if what I ask is trivial.

I'm trying to use systemd for a service that periodically downloads data from binance. Everything works fine and it starts after booting, but I can't access it with systemctl. When I run systemctl status binance-sync I get

Unit binance-sync.service could not be found.

Nevertheless it does run. I believe the issue relates to the fact this is a non-root service. The binance-sync.service is located in ~/.config/systemd/user, and it has a link in ~/.config/systemd/user/default.target.wants. When running systemd-cgls I can see under [email protected] an entry binance-sync.service with the list of processes it has activated.

Any idea how can I access it via systmctl? Specifically I would like to be able to stop/restart it.

Here's the service file if it helps:

[Unit]
Description=Binance data sync service
After=network.target

[Service]
WorkingDirectory=/home/shay-work/IdeaProjects/Tarde/src/main/python/scripts
ExecStart=/bin/bash /home/shay-work/IdeaProjects/Tarde/src/main/python/scripts/binance_sync.bash
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Type=simple
Restart=on-failure
RestartSec=30

[Install]
WantedBy=default.target

Thanks!


Solution

  • To access user service add --user.

    systemctl status --user binance-sync