Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Initialize system environment
0004 ##   ndrxd      Start/Stop EnduroX
0005 ##   chkconfig: 345 95 5
0006 ##   description: Start EnduroX Domain for user
0007 ##   processname: ndrxd
0008 ##
0009 ## @file init-d-rhel-endurox-user
0010 ##
0011 ## -----------------------------------------------------------------------------
0012 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0013 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0014 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0015 ## This software is released under one of the following licenses:
0016 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0017 ## See LICENSE file for full text.
0018 ## -----------------------------------------------------------------------------
0019 ## AGPL license:
0020 ##
0021 ## This program is free software; you can redistribute it and/or modify it under
0022 ## the terms of the GNU Affero General Public License, version 3 as published
0023 ## by the Free Software Foundation;
0024 ##
0025 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0026 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0027 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0028 ## for more details.
0029 ##
0030 ## You should have received a copy of the GNU Affero General Public License along 
0031 ## with this program; if not, write to the Free Software Foundation, Inc.,
0032 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0033 ##
0034 ## -----------------------------------------------------------------------------
0035 ## A commercial use license is available from Mavimax, Ltd
0036 ## contact@mavimax.com
0037 ## -----------------------------------------------------------------------------
0038 ##
0039 
0040 #
0041 # Note that for user environment shall load automatically with su - !
0042 # this can be done in users .bashrc file, for example:
0043 # $ cat /home/mrun/.bashrc
0044 #. /enduro/mrun/conf/setmrun
0045 #
0046 #
0047 # To add this to the init, use command 
0048 # # chkconfig --add endurox-$USER
0049 
0050 
0051 # Source function library
0052 . /etc/init.d/functions
0053 
0054 # Get network config
0055 . /etc/sysconfig/network
0056 
0057 RETVAL=0
0058 USER=mrun
0059 
0060 init_env() {
0061         /opt/endurox/bin/sysenv.sh
0062 }
0063 
0064 start() {
0065     echo $"Starting EnduroX for $USER:" 
0066     init_env
0067     # Start me up!
0068     su - $USER -c "xa start -y"
0069     RETVAL=$?
0070     echo
0071     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/endurox-${USER}
0072         #sleep 20
0073     return $RETVAL
0074 }
0075 
0076 stop() {
0077     echo $"Stopping EnduroX for $USER:" 
0078     su - $USER -c "xa stop -c -y"
0079     RETVAL=$?
0080     echo
0081     [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/endurox-${USER}
0082     return $RETVAL
0083 }    
0084 
0085 restart() {
0086       stop
0087     start
0088 }    
0089 
0090 reload() {
0091     su - $USER -c "xa reload"
0092 }
0093 
0094 case "$1" in
0095   start)
0096       start
0097     ;;
0098   stop)
0099       stop
0100     ;;
0101   status)
0102     su - $USER -c "xa stat"
0103     ;;
0104   restart)
0105       restart
0106     ;;
0107   condrestart)
0108       [ -f /var/lock/subsys/endurox-${USER} ] && restart || :
0109     ;;
0110   reload)
0111     reload
0112     ;;
0113   *)
0114     echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" 
0115     exit 1
0116 esac
0117 
0118 exit $?
0119 # vim: set ts=4 sw=4 et smartindent: