monkeyd 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. #
  3. # monkey monkey
  4. #
  5. # chkconfig: 2345 95 5
  6. #
  7. # description: monkey WebServer daemon
  8. #
  9. # $Id: monkeyd.init,v 1.5 2003/07/07 00:22:47 ankry Exp $
  10. # Source function library.
  11. . /etc/rc.d/init.d/functions
  12. # Source networking configuration.
  13. . /etc/sysconfig/network
  14. # Check that networking is up.
  15. if is_yes "${NETWORKING}"; then
  16. if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
  17. # nls "ERROR: Networking is down. %s can't be run." <service>
  18. msg_network_down monkey
  19. exit 1
  20. fi
  21. else
  22. exit 0
  23. fi
  24. RETVAL=0
  25. case "$1" in
  26. start)
  27. # Check if the service is already running?
  28. if [ ! -f /var/lock/subsys/monkey ]; then
  29. # show "Starting %s service" monkey
  30. msg_starting monkey
  31. daemon monkey -D
  32. RETVAL=$?
  33. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monkey
  34. else
  35. # show "%s service is already running." monkey
  36. msg_already_running monkey
  37. fi
  38. ;;
  39. stop)
  40. if [ -f /var/lock/subsys/monkey ]; then
  41. # Stop daemons.
  42. # show "Stopping %s service" monkey
  43. msg_stopping monkey
  44. killproc monkey
  45. rm -f /var/lock/subsys/monkey
  46. else
  47. # show "%s service is not running." monkey
  48. msg_not_running monkey
  49. fi
  50. ;;
  51. status)
  52. status monkey
  53. exit $?
  54. ;;
  55. restart|force-reload)
  56. $0 stop
  57. $0 start
  58. exit $?
  59. ;;
  60. *)
  61. # show "Usage: %s {start|stop|restart|force-reload|status}"
  62. msg_usage "$0 {start|stop|restart|force-reload|status}"
  63. exit 3
  64. esac
  65. exit $RETVAL
  66. # This must be last line !
  67. # vi:syntax=sh:tw=78:ts=8:sw=4