Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.22 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:             openerp-server
  5. # Required-Start:       $remote_fs $syslog postgresql
  6. # Required-Stop:        $remote_fs $syslog
  7. # Should-Start:         $network
  8. # Should-Stop:          $network
  9. # Default-Start:        2 3 4 5
  10. # Default-Stop:         0 1 6
  11. # Short-Description:    Enterprise Resource Management software
  12. # Description:          Open ERP is a complete ERP and CRM software.
  13. ### END INIT INFO
  14.  
  15. PATH=/bin:/sbin:/usr/bin
  16. DAEMON=/home/odoo/openerp-server
  17. NAME=odoo-server
  18. DESC=odoo-server
  19.  
  20. # Specify the user name (Default: openerp).
  21. USER=odoo
  22.  
  23. # Specify an alternate config file (Default: /etc/openerp-server.conf).
  24. CONFIGFILE="/etc/openerp-server.conf"
  25.  
  26. # pidfile
  27. PIDFILE=/var/run/$NAME.pid
  28.  
  29. # Additional options that are passed to the Daemon.
  30. DAEMON_OPTS="-c $CONFIGFILE"
  31.  
  32. [ -x $DAEMON ] || exit 0
  33. [ -f $CONFIGFILE ] || exit 0
  34.  
  35. checkpid() {
  36.     [ -f $PIDFILE ] || return 1
  37.     pid=`cat $PIDFILE`
  38.     [ -d /proc/$pid ] && return 0
  39.     return 1
  40. }
  41.  
  42. case "${1}" in
  43.         start)
  44.                 echo -n "Starting ${DESC}: "
  45.  
  46.                 start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
  47.                         --chuid ${USER} --background --make-pidfile \
  48.                         --exec ${DAEMON} -- ${DAEMON_OPTS}
  49.  
  50.                 echo "${NAME}."
  51.                 ;;
  52.  
  53.         stop)
  54.                 echo -n "Stopping ${DESC}: "
  55.  
  56.                 start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
  57.                         --oknodo
  58.  
  59.                 echo "${NAME}."
  60.                 ;;
  61.  
  62.         restart|force-reload)
  63.                 echo -n "Restarting ${DESC}: "
  64.  
  65.                 start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
  66.                         --oknodo
  67.  
  68.                 sleep 1
  69.  
  70.                 start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
  71.                         --chuid ${USER} --background --make-pidfile \
  72.                         --exec ${DAEMON} -- ${DAEMON_OPTS}
  73.  
  74.                 echo "${NAME}."
  75.                 ;;
  76.  
  77.         *)
  78.                 N=/etc/init.d/${NAME}
  79.                 echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
  80.                 exit 1
  81.                 ;;
  82. esac
  83.  
  84. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement