fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: openerp-server
  4. # Required-Start: $remote_fs $syslog
  5. # Required-Stop: $remote_fs $syslog
  6. # Should-Start: $network
  7. # Should-Stop: $network
  8. # Default-Start: 2 3 4 5
  9. # Default-Stop: 0 1 6
  10. # Short-Description: Enterprise Resource Management software
  11. # Description: Open ERP is a complete ERP and CRM software.
  12. ### END INIT INFO
  13. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  14. PYTHON=/srv/virtualenv/default/bin/python
  15. DAEMON=/opt/apps/0k-oe/openobject-server/openerp-server
  16. NAME=openerp-server
  17. DESC=openerp-server
  18. DEFAULT_FILE=/etc/default/openerp-server
  19. DBFILTER="'.*'"
  20. [ -e "$DEFAULT_FILE" ] && . "$DEFAULT_FILE"
  21. USER=openerp
  22. test -x ${DAEMON} || exit 0
  23. set -e
  24. case "${1}" in
  25. start)
  26. echo -n "Starting ${DESC}: "
  27. start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
  28. --chuid ${USER} --background --make-pidfile \
  29. --exec ${PYTHON} -- ${DAEMON} --config=/etc/openerp-server.conf \
  30. --logfile=/var/log/openerp/openerp-server.log \
  31. --db-filter="$DBFILTER"
  32. echo "${NAME}."
  33. ;;
  34. stop)
  35. echo -n "Stopping ${DESC}: "
  36. start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
  37. --oknodo
  38. echo "${NAME}."
  39. ;;
  40. restart|force-reload)
  41. echo -n "Restarting ${DESC}: "
  42. start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
  43. --oknodo
  44. sleep 1
  45. start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
  46. --chuid ${USER} --background --make-pidfile \
  47. --exec ${PYTHON} -- ${DAEMON} --config=/etc/openerp-server.conf \
  48. --logfile=/var/log/openerp/openerp-server.log \
  49. --db-filter="$DBFILTER"
  50. echo "${NAME}."
  51. ;;
  52. *)
  53. N=/etc/init.d/${NAME}
  54. echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
  55. exit 1
  56. ;;
  57. esac
  58. exit 0