You are not logged in.

#1 2014-08-29 02:17:43

maseone
Member
Registered: 2014-08-27
Posts: 11

[SOLVED] systemd user unit for lsyncd

After following the the systemd/User - Basic setup wiki article I have successfully setup user services for systemd.  I've also setup a systemd user "unit" to run lsyncd.  The user unit appears to start successfully based on the unit status shown below.  Only problem is lsyncd isn't running and I'm not seeing any relevant errors or info with journalctl.  If I run the script defined in ExecStart on the command line lsyncd starts as expected.  Any ideas or pointers?

OUTPUT from "systemctl --user lsyncd.service":

lsyncd.service - lsyncd
   Loaded: loaded (/home/maseone/.config/systemd/user/lsyncd.service; enabled)
   Active: inactive (dead) since Thu 2014-08-28 18:14:50 PDT; 21min ago
  Process: 630 ExecStart=/home/maseone/.lsyncd/start_lsyncd_simple.sh (code=exited, status=0/SUCCESS)
 Main PID: 630 (code=exited, status=0/SUCCESS)

Aug 28 18:14:50 archie230x systemd[610]: Starting lsyncd...
Aug 28 18:14:50 archie230x systemd[610]: Started lsyncd.
UNIT for lsyncd:

[Unit]
Description=lsyncd

[Service]
ExecStart=/home/maseone/.lsyncd/start_lsyncd_simple.sh

[Install]
WantedBy=default.target
SCRIPT defined in ExecStart:

#! /bin/sh
/bin/lsyncd -log all /home/maseone/.lsyncd/lsyncd.lua

Last edited by maseone (2014-08-29 04:07:58)

Offline

#2 2014-08-29 02:22:43

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] systemd user unit for lsyncd

Try changing the service type to forking instead of simple. Or look for an lsycd option that keeps it running in the foreground.

Scott

Offline

#3 2014-08-29 04:07:36

maseone
Member
Registered: 2014-08-27
Posts: 11

Re: [SOLVED] systemd user unit for lsyncd

firecat53 wrote:

Try changing the service type to forking instead of simple. Or look for an lsycd option that keeps it running in the foreground.

Scott

Thanks for the pointer, it worked!  After reading in detail the different types available "forking" does seem the most appropriate type for a daemon written as lsyncd.  I believe using an lsyncd option named "detach" would have worked with the "simple" type but forking seemd more appropriate in my case.

Also as an update to my original post I have completely removed the use of the shell script and am now calling lsyncd directly in my defined systemd unit.  Also using the %h variable for the home directory now.

REVISED unit file:

[Unit]
Description=lsyncd

[Service]
Type=forking
ExecStart=/bin/lsyncd -log scarce %h/.lsyncd/lsyncd.lua

[Install]
WantedBy=default.target

Offline

Board footer

Powered by FluxBB