#!/bin/sh # # Slackware startup script for TinyERP Server # Written by Francis David on 07 March 2008 # Last revision on -- # # Based on startup script fro PostgresSQL # Original author: Ken Zalewski # # NOTES: # This script can be run directly from a root command sheel, using: # root# /etc/rc.d/rc.tinyerp-server start # or # root# /etc/rc.d/rc.tinyerp-server stop # # For automatic startup, it should be added to /tc/rc.d/rc.M, just # beneath the MySQL startup. A sample startup line: # # [ -x /etc/rc.d/rc.tinyerp-server ] && /etc/rc.d/rc.tinyerp-server start # # or more traditionally: # # if [ -x /etc/rc.d/rc.tinyerp-server ]; then # /etc/rc.d/rc.tinyerp-server start # fi # # Note that this script should NOT be sourced (using the "." command), # since it contains "exit" statements which would cause rc.M to exit # prematurely. This is similar to rc.cups, which also cannot be sourced. # PGUSER=postgres TINY="/usr/lib/python2.4/site-packages/tinyerp-server" BIN="tinyerp-server.py" PARAM="-without-demo=all" DAEMON="$TINY/$BIN $PARAM" LOG="$TINY/tinyerp-server.log" if [ ! -e "$LOG" ]; then touch "$LOG" || exit 1 chmod go-rwx "$LOG" fi start() { echo -n "Starting TinyERP Server: " su - $PGUSER -c "$DAEMON" >> $LOG & [ $? -eq 0 ] && echo "ok" || echo "failed" } stop() { echo "Stoping TinyERP Server" killall "$BIN" } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart) restart ;; *) echo "Usage: $0 {start|stop|restart}" 1>&2 exit 1 ;; esac exit 0