You are not logged in.

#1 2015-05-25 05:19:44

eduncan911
Member
Registered: 2015-05-02
Posts: 93
Website

[SOLVED] systemd/User, starting a Dependent service

I am missing something simple here.  I have two services.  Once is dependent on the other.

I got the first service to start with:

$ cat ~/.config/systemd/user/syncthing@.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=https://github.com/syncthing/syncthing/wiki
After=network.target

[Service]
#User=%i
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing -no-browser -logflags=0
Restart=on-failure
SuccessExitStatus=2 3 4
RestartForceExitStatus=3 4

[Install]
#WantedBy=multi-user.target
WantedBy=default.target

This autostarts upon logging in with i3 and gnome.  No problem (now).

The problem I have is with the notifier/watcher:

$ cat ~/.config/systemd/user/syncthing-inotify@.service

[Unit]
Description=Syncthing Inotify File Watcher for %I
Documentation=https://github.com/syncthing/syncthing-inotify/blob/master/README.md
After=network.target syncthing@.service
Requires=syncthing@.service

[Service]
#User=%i
ExecStart=/usr/bin/syncthing-inotify -logflags=0
SuccessExitStatus=2
Restart=on-failure
ProtectSystem=full
ProtectHome=read-only

[Install]
#WantedBy=multi-user.target
WantedBy=default.target

Installed it into my namespace, like I did with the parent service:

$ systemctl --user enable syncthing-inotify@eric.service

On system startup/login, the service is "Dead (inactive)."

But, I can start it manually:

$ systemctl --user start syncthing-inotify@eric.service

And the status of the service shows it logging and working, picking up changes, etc.

I must be missing a configuration parameter in the service file.

Last edited by eduncan911 (2015-05-25 14:39:38)

Offline

#2 2015-05-25 06:46:00

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] systemd/User, starting a Dependent service

Just a shot in the dark, but try to change the After= and Requires= lines in syncthing-inotify@.service to

After=network.target syncthing@%i.service
Requires=syncthing@%i.service

About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#3 2015-05-25 14:39:00

eduncan911
Member
Registered: 2015-05-02
Posts: 93
Website

Re: [SOLVED] systemd/User, starting a Dependent service

mauritiusdadd wrote:

Just a shot in the dark, but try to change the After= and Requires= lines in syncthing-inotify@.service to

After=network.target syncthing@%i.service
Requires=syncthing@%i.service

You know how you stay up late and everything you do right seems to be wrong?

When I ran:

systemctl status syncthing-inotify@eric.service

...it showed inactive (dead) and is the reason I made this thread. 

Changed it to this:

systemctl --user status syncthing-inotify@eric.service

Allowed me to see it started.  *head smack*

And btw, I tried "syncthing@%i.service" and it worked too!  I reverted back to "syncthing@.service" to verify %i fixed it, but it started as well as before.  So "%i" seems agnostic and would work as well.

Offline

Board footer

Powered by FluxBB