xinetd.servis 703 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. . /etc/rc.conf
  3. . /etc/rc.d/functions
  4. PID=`pidof -o %PPID /usr/sbin/xinetd`
  5. case "$1" in
  6. start)
  7. stat_busy "Starting xinetd"
  8. [ -z "$PID" ] && /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
  9. if [ $? -gt 0 ]; then
  10. stat_fail
  11. else
  12. echo $PID > /var/run/xinetd.pid
  13. add_daemon xinetd
  14. stat_done
  15. fi
  16. ;;
  17. stop)
  18. stat_busy "Stopping xinetd"
  19. [ ! -z "$PID" ] && kill $PID &> /dev/null
  20. if [ $? -gt 0 ]; then
  21. stat_fail
  22. else
  23. rm -f /var/run/xinetd.pid
  24. rm_daemon xinetd
  25. stat_done
  26. fi
  27. ;;
  28. restart)
  29. $0 stop
  30. sleep 1
  31. $0 start
  32. ;;
  33. *)
  34. echo "usage: $0 {start|stop|restart}"
  35. esac
  36. exit 0