summaryrefslogtreecommitdiffstats
path: root/business/trytond/rc.trytond
blob: 8d821a3909d41bdebb51babee77415a63ac860f3 (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
#!/bin/sh
# Start/stop/restart trytond server.
# Author: Ken Roberts <alisonken1@juno.com>
# ---------------------------------------------------------------------------

PIDFILE=/var/spool/trytond/trytond.pid
LOGFILE=/var/log/trytond/trytond.log

# Start openerp:
trytond_start() {
  if [ -x /usr/bin/trytond ]; then
    echo "Starting trytond server:  /usr/bin/trytond "
    if [ -e "$PIDFILE" ]; then
        echo "trytond  server already running!"
        echo "If trytond is not running (improper shutdown?), then remove ${PIDFILE}"
    else
        /usr/bin/trytond --pidfile=$PIDFILE --logfile=$LOGFILE \
          -c /etc/trytond/trytond.conf &
    fi
  fi
}

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

# Restart trytond:
trytond_restart() {
  trytond_stop
  sleep 1
  trytond_start
}

case "$1" in
'start')
  trytond_start
  ;;
'stop')
  trytond_stop
  ;;
'restart')
  trytond_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac