Difference between revisions of "OS4X Core init script"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | For runlevel scripts, this script can be used as a basis for further needs. It works good in an OS4XBox environment. | + | For runlevel scripts, this script can be used as a basis for further needs. It works good in an OS4XBox environment. Actual versions of init-scripts can be found here: http://www.os4x.com/downloads/init-scripts/ |
<pre> | <pre> | ||
#! /bin/sh | #! /bin/sh |
Revision as of 20:17, 11 April 2007
For runlevel scripts, this script can be used as a basis for further needs. It works good in an OS4XBox environment. Actual versions of init-scripts can be found here: http://www.os4x.com/downloads/init-scripts/
#! /bin/sh ### BEGIN INIT INFO # Provides: OS4X # Required-Start: mysql # Should-Start: mysql # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: OS4X # Description: Start and stop OS4X daemons ### END INIT INFO # Check for existence of needed config file and read it OS4X_CONFIG=/etc/os4x.conf test -r $OS4X_CONFIG || { echo "$OS4X_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } # first, source the config file for database parameters . $OS4X_CONFIG # retrieve backup directory OS4X_BINDIR=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='bin_directory'" | $MYSQLCLIENT --silent --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME` OS4X_ENTERPRISE=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='os4x_enterprise'" | $MYSQLCLIENT --silent --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME` # Check for missing binaries (stale symlinks should not happen) # Note: Special treatment of stop for LSB conformance OS4XRD_BIN=$OS4X_BINDIR/os4xrd test -x $OS4XRD_BIN || { echo "$OS4XRD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } OS4XSQD_BIN=$OS4X_BINDIR/os4xsqd test -x $OS4XSQD_BIN || { echo "$OS4XSQD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } OS4XDEBUGD_BIN=$OS4X_BINDIR/os4xdebugd test -x $OS4XDEBUGD_BIN || { echo "$OS4XDEBUGD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } if [ $OS4X_ENTERPRISE -gt 0 ] then OS4XCLIENTD_BIN=$OS4X_BINDIR/os4xclientd test -x $OS4XCLIENTD_BIN || { echo "$OS4XCLIENTD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } fi case "$1" in start) echo -n "Starting OS4X " echo -n "os4xrd... " $OS4XRD_BIN echo -n "os4xsqd... " $OS4XSQD_BIN echo -n "os4xdebugd... " $OS4XDEBUGD_BIN if [ $OS4X_ENTERPRISE -gt 0 ] then echo -n "os4xclientd... " $OS4XCLIENTD_BIN fi echo "OK" ;; stop) echo -n "Shutting down OS4X " echo -n "os4xrd... " killall os4xrd 1> /dev/null 2>1 echo -n "os4xsqd... " killall os4xsqd 1> /dev/null 2>1 echo -n "os4xdebugd... " killall os4xdebugd 1> /dev/null 2>1 if [ $OS4X_ENTERPRISE -gt 0 ] then echo -n "os4xclientd... " killall os4xclientd 1> /dev/null 2>1 fi echo OK ;; status) echo -n "Checking for service OS4X " pidof os4xrd > /dev/null if [ $? -ne 0 ] then echo -n "... os4xrd is not running" else echo -n "... os4xrd OK " fi pidof os4xsqd > /dev/null if [ $? -ne 0 ] then echo -n "... os4xsqd is not running" else echo -n "... os4xsqd OK " fi pidof os4xdebugd > /dev/null if [ $? -ne 0 ] then echo "... os4xdebugd is not running" else echo -n "... os4xdebugd OK " fi if [ $OS4X_ENTERPRISE -gt 0 ] then pidof os4xclientd > /dev/null if [ $? -ne 0 ] then echo "... os4xclientd is not running" else echo "... os4xclientd OK " fi else echo "" fi ;; *) echo "Usage: $0 {start|stop|status}" exit 1 ;; esac # rc_exit