@@ -53,10 +53,10 @@ function Filebrowser:start()
5353 -- and a log file.
5454 local cmd = string.format (
5555 " start-stop-daemon -S "
56- .. " --make-pidfile --pidfile %s " -- pidFilePath
57- .. " --oknodo "
58- .. " --background "
59- .. " --exec %s " -- binPath
56+ .. " -m -p %s " -- pidFilePath
57+ .. " -o "
58+ .. " -b "
59+ .. " -x %s " -- binPath
6060 .. " -- "
6161 .. " -a 0.0.0.0 "
6262 .. " -r %s " -- dataPath
@@ -102,17 +102,17 @@ function Filebrowser:start()
102102end
103103
104104function Filebrowser :isRunning ()
105- -- Use start-stop-daemon -K (to stop a process) in --test mode to find if
106- -- there are any matching processes for this pidfile and executable. If
107- -- there are any matching processes, this exits with status code 0 .
105+ -- Run start-stop-daemon in “ stop” mode (-K) with signal 0 (no-op)
106+ -- to test whether any process matches this pidfile and executable.
107+ -- Exit code: 0 → at least one process found, 1 → none found .
108108 local cmd = string.format (
109- " start-stop-daemon --pidfile %s --exec %s -K --test " ,
109+ " start-stop-daemon -K -s 0 -p %s -x %s " ,
110110 pidFilePath ,
111111 binPath
112112 )
113113
114114 logger .dbg (" [Filebrowser] Check if Filebrowser is running: " , cmd )
115-
115+
116116 local status = os.execute (cmd )
117117
118118 logger .dbg (" [Filebrowser] Running status exit code (0 -> running): " , status )
@@ -124,7 +124,7 @@ function Filebrowser:stop()
124124 -- Use start-stop-daemon -K to stop the process, with --oknodo to exit with
125125 -- status code 0 if there are no matching processes in the first place.
126126 local cmd = string.format (
127- " start-stop-daemon --pidfile %s --exec %s --oknodo -K " ,
127+ " start-stop-daemon -K -o -p %s -x %s " ,
128128 pidFilePath ,
129129 binPath
130130 )
@@ -135,10 +135,10 @@ function Filebrowser:stop()
135135 if Device :isKindle () then
136136 logger .dbg (" [Filebrowser] Closing port: " , filebrowser_port )
137137 os.execute (string.format (" %s %s %s" ,
138- " iptables -D INPUT -p tcp --dport" , self .SSH_port ,
138+ " iptables -D INPUT -p tcp --dport" , self .filebrowser_port ,
139139 " -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT" ))
140140 os.execute (string.format (" %s %s %s" ,
141- " iptables -D OUTPUT -p tcp --sport" , self .SSH_port ,
141+ " iptables -D OUTPUT -p tcp --sport" , self .filebrowser_port ,
142142 " -m conntrack --ctstate ESTABLISHED -j ACCEPT" ))
143143 end
144144 local status = os.execute (cmd )
0 commit comments