wok view openerp-server/stuff/etc/init.d/openerp-server @ rev 13042

xtel: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jun 15 16:06:40 2012 +0200 (2012-06-15)
parents 33393d6644ce
children 0d8a1a3edc72
line source
1 #!/bin/sh
2 # /etc/init.d/openerp-server : Start, stop and restart OpenERP server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start OpenERP server at boot time, just put openerp-server in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=OpenERP
12 DESC="OpenERP server"
13 DAEMON=/usr/bin/openerp-server
14 OPTIONS=$OPENERP_OPTIONS
15 PIDFILE=/var/run/openerp/openerp-server.pid
16 LOGFILE=/var/log/openerp/openerp-server.log
17 CONFIGFILE=/etc/openerp/openerp-server.cfg
19 if [ -z "$OPTIONS" ]; then
20 OPTIONS="--pidfile=$PIDFILE --logfile=$LOGFILE -c $CONFIGFILE"
21 LANG=$(. /etc/locale.conf; echo $LANG)
22 [ -f /usr/lib/python*/site-packages/tinyerp-server/i18n/$LANG.csv ] && \
23 OPTIONS="$OPTIONS -l $LANG"
24 fi
26 case "$1" in
27 start)
28 if active_pidfile $PIDFILE python ; then
29 echo "$NAME already running (PID: `cat $PIDFILE`)."
30 exit 1
31 fi
32 echo -n "Starting $DESC: $NAME... "
33 $DAEMON $OPTIONS &
34 status
35 sleep 4
36 # At boot OpenERP dont start correctly if we start it in background.
37 if ! active_pidfile $PIDFILE python ; then
38 sleep 6
39 $DAEMON $OPTIONS > $LOGFILE
40 fi ;;
41 stop)
42 if ! active_pidfile $PIDFILE python ; then
43 echo "$NAME is not running."
44 exit 1
45 fi
46 echo -n "Stopping $DESC: $NAME... "
47 kill `cat $PIDFILE`
48 rm -f $PIDFILE
49 status
50 sleep 2 ;;
51 restart)
52 if ! active_pidfile $PIDFILE python ; then
53 echo "$NAME is not running."
54 exit 1
55 fi
56 echo -n "Restarting $DESC: $NAME... "
57 kill `cat $PIDFILE`
58 rm -f $PIDFILE 2> /dev/null
59 sleep 2
60 $DAEMON $OPTIONS &
61 status
62 sleep 2 ;;
63 *)
64 echo ""
65 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
66 echo ""
67 exit 1 ;;
68 esac
70 exit 0