Difference between revisions of "Seon Core init script"
From Seon
(New page: For runlevel scripts, this script can be used as a basis for further needs. It works good in an SeonBox environment. <pre> #! /bin/sh ### BEGIN INIT INFO # Provides: Seon # Requir...) |
|||
Line 22: | Line 22: | ||
# retrieve backup directory | # retrieve backup directory | ||
− | Seon_BINDIR=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='bin_directory'" | | + | Seon_BINDIR=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='bin_directory'" | $MYSQLCLIENT --silent --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME` |
+ | Seon_ENTERPRISE=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='seon_enterprise'" | $MYSQLCLIENT --silent --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME` | ||
# Check for missing binaries (stale symlinks should not happen) | # Check for missing binaries (stale symlinks should not happen) | ||
Line 41: | Line 42: | ||
else exit 5; fi; } | else exit 5; fi; } | ||
− | SeonCLIENTD_BIN=$Seon_BINDIR/seonclientd | + | if [ $Seon_ENTERPRISE -gt 0 ] |
− | test -x $SeonCLIENTD_BIN || { echo "$SeonCLIENTD_BIN not installed"; | + | then |
− | + | SeonCLIENTD_BIN=$Seon_BINDIR/seonclientd | |
− | + | test -x $SeonCLIENTD_BIN || { echo "$SeonCLIENTD_BIN not installed"; | |
+ | if [ "$1" = "stop" ]; then exit 0; | ||
+ | else exit 5; fi; } | ||
+ | fi | ||
case "$1" in | case "$1" in | ||
Line 55: | Line 59: | ||
echo -n "seondebugd... " | echo -n "seondebugd... " | ||
$SeonDEBUGD_BIN | $SeonDEBUGD_BIN | ||
− | echo -n "seonclientd... " | + | if [ $Seon_ENTERPRISE -gt 0 ] |
− | + | then | |
+ | echo -n "seonclientd... " | ||
+ | $SeonCLIENTD_BIN | ||
+ | fi | ||
echo "OK" | echo "OK" | ||
;; | ;; | ||
Line 67: | Line 74: | ||
echo -n "seondebugd... " | echo -n "seondebugd... " | ||
killall seondebugd 1> /dev/null 2>1 | killall seondebugd 1> /dev/null 2>1 | ||
− | echo -n "seonclientd... " | + | if [ $Seon_ENTERPRISE -gt 0 ] |
− | + | then | |
+ | echo -n "seonclientd... " | ||
+ | killall seonclientd 1> /dev/null 2>1 | ||
+ | fi | ||
echo OK | echo OK | ||
;; | ;; | ||
Line 94: | Line 104: | ||
echo -n "... seondebugd OK " | echo -n "... seondebugd OK " | ||
fi | fi | ||
− | + | if [ $Seon_ENTERPRISE -gt 0 ] | |
− | if [ $ | ||
then | then | ||
− | + | pidof seonclientd > /dev/null | |
+ | if [ $? -ne 0 ] | ||
+ | then | ||
+ | echo "... seonclientd is not running" | ||
+ | else | ||
+ | echo "... seonclientd OK " | ||
+ | fi | ||
else | else | ||
− | + | echo "" | |
fi | fi | ||
− | |||
;; | ;; | ||
*) | *) |
Revision as of 20:16, 11 April 2007
For runlevel scripts, this script can be used as a basis for further needs. It works good in an SeonBox environment.
#! /bin/sh ### BEGIN INIT INFO # Provides: Seon # Required-Start: mysql # Should-Start: mysql # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Seon # Description: Start and stop Seon daemons ### END INIT INFO # Check for existence of needed config file and read it Seon_CONFIG=/etc/seon.conf test -r $Seon_CONFIG || { echo "$Seon_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } # first, source the config file for database parameters . $Seon_CONFIG # retrieve backup directory Seon_BINDIR=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='bin_directory'" | $MYSQLCLIENT --silent --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME` Seon_ENTERPRISE=`echo "SELECT value FROM ${TABLEPREFIX}configuration WHERE name='seon_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 SeonRD_BIN=$Seon_BINDIR/seonrd test -x $SeonRD_BIN || { echo "$SeonRD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } SeonSQD_BIN=$Seon_BINDIR/seonsqd test -x $SeonSQD_BIN || { echo "$SeonSQD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } SeonDEBUGD_BIN=$Seon_BINDIR/seondebugd test -x $SeonDEBUGD_BIN || { echo "$SeonDEBUGD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } if [ $Seon_ENTERPRISE -gt 0 ] then SeonCLIENTD_BIN=$Seon_BINDIR/seonclientd test -x $SeonCLIENTD_BIN || { echo "$SeonCLIENTD_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } fi case "$1" in start) echo -n "Starting Seon " echo -n "seonrd... " $SeonRD_BIN echo -n "seonsqd... " $SeonSQD_BIN echo -n "seondebugd... " $SeonDEBUGD_BIN if [ $Seon_ENTERPRISE -gt 0 ] then echo -n "seonclientd... " $SeonCLIENTD_BIN fi echo "OK" ;; stop) echo -n "Shutting down Seon " echo -n "seonrd... " killall seonrd 1> /dev/null 2>1 echo -n "seonsqd... " killall seonsqd 1> /dev/null 2>1 echo -n "seondebugd... " killall seondebugd 1> /dev/null 2>1 if [ $Seon_ENTERPRISE -gt 0 ] then echo -n "seonclientd... " killall seonclientd 1> /dev/null 2>1 fi echo OK ;; status) echo -n "Checking for service Seon " pidof seonrd > /dev/null if [ $? -ne 0 ] then echo -n "... seonrd is not running" else echo -n "... seonrd OK " fi pidof seonsqd > /dev/null if [ $? -ne 0 ] then echo -n "... seonsqd is not running" else echo -n "... seonsqd OK " fi pidof seondebugd > /dev/null if [ $? -ne 0 ] then echo "... seondebugd is not running" else echo -n "... seondebugd OK " fi if [ $Seon_ENTERPRISE -gt 0 ] then pidof seonclientd > /dev/null if [ $? -ne 0 ] then echo "... seonclientd is not running" else echo "... seonclientd OK " fi else echo "" fi ;; *) echo "Usage: $0 {start|stop|status}" exit 1 ;; esac # rc_exit