fix init scripts and error in log message
This commit is contained in:
@@ -4,5 +4,8 @@
|
|||||||
# USER="daemon"
|
# USER="daemon"
|
||||||
# USER="daemon:nobody"
|
# USER="daemon:nobody"
|
||||||
|
|
||||||
# Optional parameters for pymodmilter
|
# Set the shutdown timeout
|
||||||
|
# SHUTDOWN_TIMEOUT=300
|
||||||
|
|
||||||
|
# Optional command line options
|
||||||
# PYINOTIFYD_OPTS=""
|
# PYINOTIFYD_OPTS=""
|
||||||
|
|||||||
@@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
user=${USER:-root}
|
user=${USER:-root}
|
||||||
pyinotifyd_opts="${PYINOTIFYD_OPTS:-}"
|
pyinotifyd_opts="${PYINOTIFYD_OPTS:-}"
|
||||||
|
shutdown_timeout="${SHUTDOWN_TIMEOUT:-300}"
|
||||||
|
|
||||||
pidfile="/run/${RC_SVCNAME}.pid"
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
command="/usr/bin/pyinotifyd"
|
command="/usr/bin/pyinotifyd"
|
||||||
command_args="${pyinotifyd_opts}"
|
command_args="${pyinotifyd_opts}"
|
||||||
command_background=true
|
command_background=true
|
||||||
start_stop_daemon_args="--user ${user}"
|
start_stop_daemon_args="--user ${user}"
|
||||||
|
retry="SIGTERM/${shutdown_timeout}"
|
||||||
|
|
||||||
extra_commands="configtest"
|
extra_commands="configtest reload"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need net
|
need net
|
||||||
@@ -44,3 +46,9 @@ stop_pre() {
|
|||||||
checkconfig || return $?
|
checkconfig || return $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading ${SVCNAME}"
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ After=fs.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/pyinotifyd
|
ExecStart=/usr/bin/pyinotifyd
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
TimeoutStopSec=300
|
TimeoutStopSec=300
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class _Task:
|
|||||||
self.cancel()
|
self.cancel()
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def task_id():
|
def task_id(self):
|
||||||
return self._task_id
|
return self._task_id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -100,16 +100,8 @@ class Watch:
|
|||||||
|
|
||||||
def event_notifier(self, wm, loop=asyncio.get_event_loop()):
|
def event_notifier(self, wm, loop=asyncio.get_event_loop()):
|
||||||
handler = pyinotify.ProcessEvent()
|
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(
|
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)
|
do_glob=True)
|
||||||
|
|
||||||
return pyinotify.AsyncioNotifier(wm, loop, default_proc_fun=handler)
|
return pyinotify.AsyncioNotifier(wm, loop, default_proc_fun=handler)
|
||||||
|
|||||||
Reference in New Issue
Block a user