ip-sentinel.init 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2006 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. CFG_FILE="/etc/ip-sentinel.cfg"
  5. depend() {
  6. need net
  7. }
  8. checkconfig() {
  9. if [ ! -f "${CFG_FILE}" ] ; then
  10. eerror "File ${CFG_FILE} does not exists!"
  11. return 1
  12. fi
  13. if [ -n "${CHROOT}" ] ; then
  14. local_opts="--user ipsentinel --group ipsentinel -r ${CHROOT}"
  15. else
  16. local_opts="--user ipsentinel --group ipsentinel -r /"
  17. fi
  18. }
  19. start() {
  20. checkconfig || return 1
  21. ebegin "Starting ip-sentinel..."
  22. start-stop-daemon --start --quiet --exec /usr/sbin/ip-sentinel -- --ipfile ${CFG_FILE} ${local_opts} $OPTS $IFACE &
  23. eend $? "Failed to start ip-sentinel"
  24. }
  25. stop() {
  26. ebegin "Stoping ip-sentinel..."
  27. start-stop-daemon --stop --quiet --pidfile /var/run/ip-sentinel.run
  28. eend $? "Failed to stop ip-sentinel"
  29. }
  30. restart () {
  31. svc_stop
  32. echo "Please, wait while child process quit..."
  33. while `ps aux | grep -v 'init.d' | grep [i]p-sentinel >/dev/null`
  34. do
  35. echo -n ". "
  36. sleep 1
  37. done
  38. echo "[Done]"
  39. svc_start
  40. }