Control: tags 758093 +patch

On 2014-08-15, Vagrant Cascadian wrote:
> On 2014-08-14, Vagrant Cascadian wrote:
>> When running systemd as the init system, ltspfsd quietly fails to start.
>> It's normally started from udev on device insertion or media change if
>> ltspfsd isn't already started.
>
> This seems relevent:
>
>   
> http://blog.fraggod.net/2012/06/16/proper-ish-way-to-start-long-running-systemd-service-on-udev-event-device-hotplug.html

Yeah, that article points out that systemd kills off processes started
From udev after a certain timeout...


With the following ltspfsd.service file:

  [Unit]
  Description=LTSP Filesystem Daemon

  [Service]
  Type=forking
  ExecStart=/usr/bin/ltspfsd


And the following patch:

From e6671110026355d77678a2eff9c8481296cb17fc Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@debian.org>
Date: Sat, 16 Aug 2014 20:54:17 -0700
Subject: [PATCH] Attempt to start ltspfsd using systemd unit, also drop the
 pid check, as it failed as often as it worked.

---
 scripts/ltspfs_entry | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/ltspfs_entry b/scripts/ltspfs_entry
index 4fc0fdf..fa84c40 100644
--- a/scripts/ltspfs_entry
+++ b/scripts/ltspfs_entry
@@ -101,14 +101,13 @@ remove_device()
 
 start_ltspfsd()
 {
-    if [ ! -e /var/run/ltspfsd.pid ] && [ -z "$(pgrep ltspfsd)" ]; then
+    if [ -z "$(pgrep ltspfsd)" ]; then
         # Make this sessions secret auth cookie for ltspfs
         if [ ! -f /var/run/ltspfs_token ]; then
             mcookie > /var/run/ltspfs_token
         fi
         # start up the ltspfsd daemon
-        /usr/bin/ltspfsd
-        echo $! >/var/run/ltspfsd.pid
+        systemctl start ltspfsd || /usr/bin/ltspfsd
     fi
 }
 
-- 
2.0.1


It's a little more expensive to always run pgrep, but haven't found a
simpler way to ensure that ltspfsd is actually running.

Ideally, it would at least detect if systemd was running, and then
respond accordingly, but at least this gets it working...


Could also add an init script and call "service ltspfsd start" instead,
which might work regardless of init system... ?


live well,
  vagrant

Attachment: pgpaprzMKzW2n.pgp
Description: PGP signature

Reply via email to