1
0

radicale.hotplug 530 B

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