fix init scripts and error in log message

This commit is contained in:
2020-11-05 22:50:52 +01:00
parent 82c6d4a96d
commit e970dce5d0
7 changed files with 16 additions and 12 deletions

View File

@@ -4,5 +4,8 @@
# USER="daemon"
# USER="daemon:nobody"
# Optional parameters for pymodmilter
# Set the shutdown timeout
# SHUTDOWN_TIMEOUT=300
# Optional command line options
# PYINOTIFYD_OPTS=""

View File

@@ -2,14 +2,16 @@
user=${USER:-root}
pyinotifyd_opts="${PYINOTIFYD_OPTS:-}"
shutdown_timeout="${SHUTDOWN_TIMEOUT:-300}"
pidfile="/run/${RC_SVCNAME}.pid"
command="/usr/bin/pyinotifyd"
command_args="${pyinotifyd_opts}"
command_background=true
start_stop_daemon_args="--user ${user}"
retry="SIGTERM/${shutdown_timeout}"
extra_commands="configtest"
extra_commands="configtest reload"
depend() {
need net
@@ -44,3 +46,9 @@ stop_pre() {
checkconfig || return $?
fi
}
reload() {
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}

View File

@@ -5,6 +5,7 @@ After=fs.target
[Service]
Type=simple
ExecStart=/usr/bin/pyinotifyd
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=300
[Install]

View File

@@ -57,7 +57,7 @@ class _Task:
self.cancel()
self.start()
def task_id():
def task_id(self):
return self._task_id

View File

@@ -100,16 +100,8 @@ class Watch:
def event_notifier(self, wm, loop=asyncio.get_event_loop()):
handler = pyinotify.ProcessEvent()
mask = False
for flag, values in self.event_map.items():
setattr(handler, f"process_{flag}", _TaskList(values).execute)
if mask:
mask = mask | EventMap.flags[flag]
else:
mask = EventMap.flags[flag]
wm.add_watch(
self.path, mask, rec=self.rec, auto_add=self.auto_add,
self.path, pyinotify.ALL_EVENTS, rec=self.rec, auto_add=self.auto_add,
do_glob=True)
return pyinotify.AsyncioNotifier(wm, loop, default_proc_fun=handler)