summaryrefslogtreecommitdiff
path: root/business/openerp-server/rc.openerp-server
blob: 37fa2d5bee8632c3a0b3edcd7db0aff797b040a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# Start/stop/restart openerp-server.
# $Id: rc.openerp-server,v 1.1 2009/03/31
# Author: Heinz Wiesinger <pprkut@liwjatan.at>
# ---------------------------------------------------------------------------

PIDFILE=/var/spool/openerp/openerp-server.pid
LOCKFILE=/var/lock/subsys/openerp-server
LOGFILE=/var/log/openerp/openerp-server.log

# Start openerp:
openerp_start() {
  if [ -x /usr/bin/openerp-server ]; then
    echo "Starting openerp server:  /usr/bin/openerp-server "
    if [ -e "$LOCKFILE" ]; then
        echo "openerp server already running!"
        echo "Please remove $LOCKFILE"
    else
        /usr/bin/openerp-server --pidfile=$PIDFILE --logfile=$LOGFILE \
          -c /etc/openerp/openerp-server.conf &
        touch $LOCKFILE
    fi
  fi
}

# Stop openerp:
openerp_stop() {
  echo "Stopping openerp-server"
  kill -TERM $(cat $PIDFILE) > /dev/null 2>&1
  rm -f $LOCKFILE
}

# Restart openerp:
openerp_restart() {
  openerp_stop
  sleep 1
  openerp_start
}

case "$1" in
'start')
  openerp_start
  ;;
'stop')
  openerp_stop
  ;;
'restart')
  openerp_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac