init.d/

neutron-server 是 Upstart 支持的系统服务脚本,核心部分为

  1. case "$1" in
  2. start)
  3. test "$ENABLED" = "true" || exit 0
  4. log_daemon_msg "Starting neutron server" "neutron-server"
  5. start-stop-daemon -Sbmv --pidfile $PIDFILE --chdir $DAEMON_DIR --exec $DAEMON -- $DAEMON_ARGS
  6. log_end_msg $?
  7. ;;
  8. stop)
  9. test "$ENABLED" = "true" || exit 0
  10. log_daemon_msg "Stopping neutron server" "neutron-server"
  11. start-stop-daemon --stop --oknodo --pidfile ${PIDFILE}
  12. log_end_msg $?
  13. ;;
  14. restart|force-reload)
  15. test "$ENABLED" = "true" || exit 1
  16. $0 stop
  17. sleep 1
  18. $0 start
  19. ;;
  20. status)
  21. test "$ENABLED" = "true" || exit 0
  22. status_of_proc -p $PIDFILE $DAEMON neutron-server && exit 0 || exit $?
  23. ;;
  24. *)
  25. log_action_msg "Usage: /etc/init.d/neutron-server {start|stop|restart|force-reload|status}"
  26. exit 1
  27. ;;
  28. esac