summaryrefslogtreecommitdiff
path: root/business/tinyerp-server/rc.tinyerp-server
diff options
context:
space:
mode:
Diffstat (limited to 'business/tinyerp-server/rc.tinyerp-server')
-rw-r--r--business/tinyerp-server/rc.tinyerp-server52
1 files changed, 52 insertions, 0 deletions
diff --git a/business/tinyerp-server/rc.tinyerp-server b/business/tinyerp-server/rc.tinyerp-server
new file mode 100644
index 0000000000..a5314c0f90
--- /dev/null
+++ b/business/tinyerp-server/rc.tinyerp-server
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Start/stop/restart tinyerp-server.
+# $Id: rc.tinyerp-server,v 1.0 2008/06/02
+# Author: Heinz Wiesinger <hmwiesinger@gmx.at>
+# ---------------------------------------------------------------------------
+
+PIDFILE=/var/spool/tinyerp/tinyerp-server.pid
+LOCKFILE=/var/lock/subsys/tinyerp-server
+LOGFILE=/var/log/tinyerp/tinyerp-server.log
+
+# Start tinyerp:
+tinyerp_start() {
+ if [ -x /usr/bin/tinyerp-server ]; then
+ echo "Starting tinyerp server: /usr/bin/tinyerp-server "
+ if [ -e "$LOCKFILE" ]; then
+ echo "tinyerp server already running!"
+ echo "Please remove $LOCKFILE"
+ else
+ /usr/bin/tinyerp-server --pidfile=$PIDFILE --logfile=$LOGFILE \
+ -c /etc/tinyerp/tinyerp-server.conf &
+ touch $LOCKFILE
+ fi
+ fi
+}
+
+# Stop tinyerp:
+tinyerp_stop() {
+ echo "Stopping tinyerp-server"
+ kill -TERM $(cat $PIDFILE) > /dev/null 2>&1
+ rm -f $LOCKFILE
+}
+
+# Restart tinyerp:
+tinyerp_restart() {
+ tinyerp_stop
+ sleep 1
+ tinyerp_start
+}
+
+case "$1" in
+'start')
+ tinyerp_start
+ ;;
+'stop')
+ tinyerp_stop
+ ;;
+'restart')
+ tinyerp_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac