Advertisement
Guest User

OpenERP Launcher

a guest
Oct 29th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.66 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:             oerp61prod
  5. # Required-Start:       $remote_fs $syslog
  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=/opt/openerp/6.1/prod/server/openerp-server
  17. NAME=oerp61prod
  18. DESC="OpenERP 6.1 Production Environment"
  19.  
  20. # Specify the user name (Default: openerp).
  21. USER=oerp61prod
  22.  
  23. # Specify an alternate config file (Default: /etc/openerp-server.conf).
  24. CONFIGFILE="/etc/oerp61prod.conf"
  25.  
  26. # Specify an alternate addons path.  Someone more familiar with this scripting language can prettify this.
  27. # For now I put 2 lines, if your not messing with addon paths uncomment the "" one, and comment out the populated one.
  28. ADDONS_PATH="--addons-path=/opt/openerp/6.1/prod/custom/,/opt/openerp/6.1/prod/web/addons,/opt/openerp/6.1/prod/openerp-usa,/opt/openerp/6.1/prod/addons"
  29. #ADDONS_PATH=""
  30.  
  31. # pidfile
  32. PIDFILE=/var/run/$NAME.pid
  33.  
  34. # Additional options that are passed to the Daemon.
  35. DAEMON_OPTS="-c $CONFIGFILE"
  36.  
  37. [ -x $DAEMON ] || exit 0
  38. [ -f $CONFIGFILE ] || exit 0
  39.  
  40. checkpid() {
  41.     [ -f $PIDFILE ] || return 1
  42.     pid=`cat $PIDFILE`
  43.     [ -d /proc/$pid ] && return 0
  44.     return 1
  45. }
  46.  
  47. case "${1}" in
  48.         start)
  49.                 echo -n "Starting ${DESC}: "
  50.                 start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
  51.                         --chuid ${USER} --background --make-pidfile \
  52.                         --exec ${DAEMON} -- ${DAEMON_OPTS} ${ADDONS_PATH}
  53.  
  54.                 echo "${NAME}."
  55.                 ;;
  56.  
  57.         stop)
  58.                 echo -n "Stopping ${DESC}: "
  59.  
  60.                 start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
  61.                         --oknodo
  62.  
  63.                 echo "${NAME}."
  64.                 ;;
  65.  
  66.         restart|force-reload)
  67.                 echo -n "Restarting ${DESC}: "
  68.  
  69.                 start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
  70.                         --oknodo
  71.      
  72.                 sleep 1
  73.  
  74.                 start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
  75.                         --chuid ${USER} --background --make-pidfile \
  76.                         --exec ${DAEMON} -- ${DAEMON_OPTS}
  77.  
  78.                 echo "${NAME}."
  79.                 ;;
  80.  
  81.         *)
  82.                 N=/etc/init.d/${NAME}
  83.                 echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
  84.                 exit 1
  85.                 ;;
  86. esac
  87.  
  88. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement