rc.trytond 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # Start/stop/restart trytond server.
  3. # Author: Ken Roberts <alisonken1@juno.com>
  4. # ---------------------------------------------------------------------------
  5. PIDFILE=/var/spool/trytond/trytond.pid
  6. LOGFILE=/var/log/trytond/trytond.log
  7. # Start openerp:
  8. trytond_start() {
  9. if [ -x /usr/bin/trytond ]; then
  10. echo "Starting trytond server: /usr/bin/trytond "
  11. if [ -e "$PIDFILE" ]; then
  12. echo "trytond server already running!"
  13. echo "If trytond is not running (improper shutdown?), then remove ${PIDFILE}"
  14. else
  15. /usr/bin/trytond --pidfile=$PIDFILE --logfile=$LOGFILE \
  16. -c /etc/trytond/trytond.conf &
  17. fi
  18. fi
  19. }
  20. # Stop trytond:
  21. trytond_stop() {
  22. echo "Stopping openerp-server"
  23. kill -TERM $(cat $PIDFILE) > /dev/null 2>&1
  24. }
  25. # Restart trytond:
  26. trytond_restart() {
  27. trytond_stop
  28. sleep 1
  29. trytond_start
  30. }
  31. case "$1" in
  32. 'start')
  33. trytond_start
  34. ;;
  35. 'stop')
  36. trytond_stop
  37. ;;
  38. 'restart')
  39. trytond_restart
  40. ;;
  41. *)
  42. echo "usage $0 start|stop|restart"
  43. esac