packages/net/radicale/files/radicale.hotplug
Christian Schoenebeck d2e9224965 [Radicale] upstream to Radicale 1.1
* upstream to Radicale 1.1
* new "boot_delay" option (default 10 seconds) to wait for interfaces to come up before hotplug restarts are enabled.

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-12-31 17:00:38 +01:00

18 lines
530 B
Bash

#!/bin/sh
# only (re-)start on ifup
[ "$ACTION" = "ifup" ] || exit 0
# only start if boot_delay is done
[ -f /tmp/radicale.hotplug ] || exit 0
_PID=$(ps | grep '[p]ython.*[r]adicale' 2>/dev/null | awk '{print $1}')
kill -1 $_PID 2>/dev/null
if [ $? -eq 0 ]; then
# only restart if already running
logger -p user.info -t "radicale[$_PID]" \
"Restart request due to '$ACTION' of interface '$INTERFACE'"
/etc/init.d/radicale restart
else
# only start if enabled
/etc/init.d/radicale enabled && /etc/init.d/radicale start
fi