travelmate: bugfix 1.3.7

* fix a possible 'reload' race condition

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2019-02-23 07:55:26 +01:00
parent a423fd57bb
commit feca82971a
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -31,14 +31,14 @@ start_service()
reload_service()
{
local ppid pid
local ppid pid timeout="$(uci_get travelmate global trm_timeout)"
if [ -s "${trm_pidfile}" ]
then
ppid="$(cat "${trm_pidfile}" 2>/dev/null)"
if [ -n "${ppid}" ]
then
pid="$(pgrep sleep -P ${ppid} 2>/dev/null)"
pid="$(pgrep -xnf "sleep ${timeout:-60} 0" -P ${ppid} 2>/dev/null)"
if [ -n "${pid}" ]
then
kill -INT ${pid} 2>/dev/null