
 A megoldás sima bash parancsokat használ és két részből áll.
A megoldás sima bash parancsokat használ és két részből áll.Az rc_domino_script-et az /opt/ibm/lotus könyvtárba kell másolni és futtatási jogot kell adni rá a root és notes usernek (lehet máshová is másolni, a domino scriptben csak át kell írni az elérési útját). Az alábbi cuccot dobd át egy rc_domino_script nevű fájlba
-----------------------------------------------------------------------------------------------
#!/bin/sh
########################################################################
# Start/Stop Script for Domino on xLinux/zLinux/AIX/Solaris
# 2005-2006 written by Daniel Nashed, feedback domino_unix@nashcom.de
# Version 1.4 02.04.2006
########################################################################
# determine notes/os level user
DOMINO_USER=$LOGNAME
# IBM WebSphere Application Server / Portal configuration for HTTP plugin
WAS_PLUGIN_CONFIG_FILE=/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-cfg.xml
export WAS_PLUGIN_CONFIG_FILE
# --- configuration per domino partition ---
if [ $DOMINO_USER = notes ]; then
  LOTUS=/opt/ibm/lotus
  DOMINO_DATA_PATH=/local/notesdata
#  DOMINO_LANG=de_DE
  DOMINO_SHUTDOWN_TIMEOUT=600
  DOMINO_CONFIGURED="yes"
elif [ $DOMINO_USER = notes1 ]; then
  # ... cloned section for each domino partition ...
  DOMINO_CONFIGURED="yes"
  
else
 echo "Domino Server for '$DOMINO_USER' not configured"
 exit 1
fi
export DOMINO_USER
export LOTUS
export DOMINO_DATA_PATH
export DOMINO_LANG
export DOMINO_START_SCRIPT
export DOMINO_SHUTDOWN_TIMEOUT
# determine architecture and platform
if [ `uname` = AIX ]; then
  LARCH=ibmpow
  PLATFORM_NAME=AIX
elif [ `uname` = SunOS ]; then
  if [ `uname -p` = sparc ]; then
    LARCH=sunspa
    PLATFORM_NAME=Solaris
  else
    LARCH=sunx86
    PLATFORM_NAME=Solaris/x86
  fi
elif [ `uname` = Linux ]; then
  LARCH=linux
  UNAME=`uname -m`
  if [ $UNAME = s390 ]; then
    PLATFORM_NAME=zLinux
  elif [ $UNAME = s390x ]; then
    PLATFORM_NAME=zLinux
  else
    PLATFORM_NAME=xLinux
  fi
  # query linux distribution
  if [ ${LARCH} = "linux" ]; then
    if [ -e /etc/SuSE-release ] ; then
      LINUX_DISTRIBUTION=suse
    elif [ -e /etc/redhat-release ] ; then
      LINUX_DISTRIBUTION=redhat
    else
      LINUX_DISTRIBUTION=unknown
    fi
  fi
fi
if [ -z "$LARCH" ]; then
  echo "Unknown platform `uname`"
  exit 1
fi
export LARCH
export PLATFORM_NAME
# shell script variable definitions
# --- configuration begin ---
# domino language settings
if [ -z "$DOMINO_LANG" ]; then
  DOMINO_LANG=de_DE
  export DOMINO_LANG
fi
# domino shutdown timeout in seconds
if [ -z "$DOMINO_SHUTDOWN_TIMEOUT" ]; then
  DOMINO_SHUTDOWN_TIMEOUT=600
  export DOMINO_SHUTDOWN_TIMEOUT
fi
# set domino binary directory
if [ -z "$LOTUS" ]; then
  LOTUS=/opt/lotus
  export LOTUS
fi
# base directory for domino server partitions
DOMINO_DATA_PATH_BASE=/local/domino
# enable to use the Java Controller
#USE_JAVA_CONTROLLER="yes"
# Broadcast a shutdown message to all users of the Domino Server
#BROADCAST_SHUTDOWN_MESSAGE="yes"
# SLES8 Linux Tuning
#SUSE_DOMINO_PTHREAD_EXTENSION="yes"
SUSE_TUNING_DIR=/opt/dominowrap/domino6
# compress command used e.g. for log file compression
COMPRESS_COMMAND="gzip --best"
PS_COMMAND="ps"
# enable script debug output
#DEBUG_MODE="yes"
# --- configuration end ---
# additional internal script variables
SCRIPT_NAME=$0
PARAM=$1
DOMINO_BIN=$LOTUS/bin/server
if [ "$DEBUG_MODE" = "yes" ] ; then
  NSD_BIN="$LOTUS/bin/nsd -debug"
else
  NSD_BIN=$LOTUS/bin/nsd
fi
if [ -z "$DOMINO_INSDIR" ]; then
  DOMINO_INSDIR=$LOTUS
  export DOMINO_INSDIR
fi
# set notes exec directory for domino c-api add-on software
Notes_ExecDirectory=$LOTUS/notes/latest/$LARCH
export Notes_ExecDirectory
# export lib search path per platform
if [ ${LARCH} = "ibmpow" ]; then
  LIBPATH=$Notes_ExecDirectory
  export LIBPATH
fi
if [ ${LARCH} = "sunspa" ]; then
  LD_LIBRARY_PATH=$Notes_ExecDirectory
  export LD_LIBRARY_PATH
fi
if [ ${LARCH} = "linux" ]; then
  LD_LIBRARY_PATH=$Notes_ExecDirectory
  export LD_LIBRARY_PATH
fi
if [ ${LARCH} = "linux" ]; then
  PS_COMMAND="ps -w"
fi
# check if data path has been already set. else set it based on user-name and base directory.
if [ -z "$DOMINO_DATA_PATH" ]; then
  DOMINO_DATA_PATH=$DOMINO_DATA_PATH_BASE/$DOMINO_USER/notesdata # path for server data directory
  export DOMINO_DATA_PATH
fi
# general environment parameters
DOMINO_SERVER=$DOMINO_USER # Name of Domino Server
DOMINO_INI_PATH=$DOMINO_DATA_PATH/notes.ini
PATH=$DOMINO_DATA_PATH:$LOTUS/bin:$Notes_ExecDirectory:$Notes_ExecDirectory/res/C:$PATH
export DOMINO_SERVER
export DOMINO_INI_PATH
export PATH
# check if log path has been already set. else set it based on user-name and base directory.
if [ -z "$DOMINO_OUTPUT_LOG" ]; then
  DOMINO_OUTPUT_LOG=$DOMINO_DATA_PATH/$DOMINO_SERVER.log # Output file for server console
  export DOMINO_OUTPUT_LOG
fi
if [ -z "$DOMINO_INPUT_FILE" ]; then
  DOMINO_INPUT_FILE=$DOMINO_DATA_PATH/$DOMINO_USER.input # Input file for server console
  export DOMINO_INPUT_FILE
fi
if [ "$USE_JAVA_CONTROLLER" = "yes" ] ; then
  JAVE_CONTROLLER_STRING="-jc -c"
fi
if [ "$LINUX_DISTRIBUTION" = "suse" ] ; then
  if [ "$SUSE_DOMINO_PTHREAD_EXTENSION" = "yes" ] ; then
    LD_PRELOAD=$SUSE_TUNING_DIR/libpthread.so:$SUSE_TUNING_DIR/librt.so:$LD_PRELOAD
    export LD_PRELOAD
  fi
fi
# environment settings needed for Domino servers
LANG=$DOMINO_LANG
export LANG
# helper functions
function stop_monitor
{
  kill -9 $MONITOR_PID > /dev/null
  echo "Live Console closed."
  echo
  echo
  exit 0
}
function DebugText
{
  if [ "$DEBUG_MODE" = "yes" ] ; then
    echo $1 $2 $3 $4 $5
  fi
}
function usage
{
  echo "Usage: `basename $SCRIPT_NAME` { start | stop | stopjc | restart | status | monitor | info | nsd | fullnsd | kill | archivelog | setenv }"
}
function errmsg
{
  echo $1 >&2
}
function cleanup_domino_server_old_style
{
  # Kill all domino processes but keep the java controller
  for pid in `$PS_COMMAND -fu $DOMINO_USER | grep "$LOTUS" | grep -v "$SCRIPT_NAME" | grep -v "grep" | grep -v " -jc" | awk '{ print $2 }'`; do
    kill -9 $pid
  done
  # Clean up IPC if the Domino Server terminated abnormally
  rm -f $DOMINO_DATA/~notes.lck
  if [ ${LARCH} = "ibmpow" ]; then
    mems=`ipcs -m | grep "$DOMINO_USER" | grep ^m | awk '{ print $2 }'`
    sems=`ipcs -s | grep "$DOMINO_USER" | grep ^s | awk '{ print $2 }'`
    mqs=`ipcs  -q | grep "$DOMINO_USER" | grep ^q | awk '{ print $2 }'`
  fi
  if [ ${LARCH} = "sunspa" ]; then
    # todo
    mems=
    sems=
    mqs=
  fi
  if [ ${LARCH} = "linux" ]; then
    mems=`ipcs -m | grep "$DOMINO_USER" | grep ^0x | awk '{ print $2 }'`
    sems=`ipcs -s | grep "$DOMINO_USER" | grep ^0x | awk '{ print $2 }'`
    mqs=`ipcs  -q | grep "$DOMINO_USER" | grep ^0x | awk '{ print $2 }'`
  fi
  for j in $mems; do if [ -n "$j" ]; then ipcrm -m $j; fi; done
  for j in $sems; do if [ -n "$j" ]; then ipcrm -s $j; fi; done
  for j in $mqs; do if [ -n "$j" ]; then ipcrm -q $j; fi; done
}
function cleanup_domino_server
{
  cd $DOMINO_DATA_PATH
  $NSD_BIN -kill
}
function cleanup_java_controller
{
  # Kill java controller process
  for pid in `$PS_COMMAND -fu $DOMINO_USER | grep "$LOTUS" | grep -v "$SCRIPT_NAME" | grep -v "grep" | grep " -jc" | awk '{ print $2 }'`; do
    kill -9 $pid
  done
  if [ -e $DOMINO_DATA_PATH/.jsc_lock ]; then
    rm $DOMINO_DATA_PATH/.jsc_lock
  fi
}
function domino_is_running
{
  DOMINO_RUNNING=`$PS_COMMAND -fu $DOMINO_USER | grep "$LOTUS" | grep "server" | grep -v " -jc"`
  DebugText "DOMINO_USER:" $DOMINO_USER
  DebugText "DOMINO_RUNNING:" $DOMINO_RUNNING
  if [[ -n $DOMINO_RUNNING ]] ; then
    DebugText "Domino is running"
    return 1
  else
    DebugText "Domino is NOT running"
    return 0
  fi
}
function domino_status_check
{
  domino_is_running
  if [ $? -eq 1 ] ; then
    echo "Domino Server is running ($DOMINO_SERVER)"
    return 0
  else
    echo "Domino Server is NOT running ($DOMINO_SERVER)"
    return 3
  fi
}
function java_controller_is_running
{
  JAVA_CONTROLLER_RUNNING=`$PS_COMMAND -fu $DOMINO_USER | grep "$LOTUS" | grep "server" | grep -v "grep" | grep " -jc"`
  if [[ -n $JAVA_CONTROLLER_RUNNING ]] ; then
    DebugText "Java Controller is running"
    return 1
  else
    DebugText "Java Controller is NOT running"
    return 0
  fi
}
function shutdown_domino_server
{
  cd $DOMINO_DATA_PATH
  $DOMINO_BIN -q >> $DOMINO_OUTPUT_LOG 2>&1 &
  count=0
  domino_is_running
  while [ $? -eq 1 ] ; do
    sleep 10
    count=`expr $count + 1`
    seconds=`expr $count "*" 10`
    echo " ... waiting $seconds seconds"
    # Terminate Domino Server if still running
    if [ "$seconds" -eq "$DOMINO_SHUTDOWN_TIMEOUT" ] ; then
      echo "Domino Server is still running after $seconds seconds"
      echo " ... now for the ungraceful method"
      cleanup_domino_server
      echo "Domino Server ($DOMINO_SERVER) TERMINATED"
      exit
    fi
    domino_is_running
  done
}
function shutdown_java_controller
{
  echo y | $DOMINO_BIN -jc -q >> $DOMINO_OUTPUT_LOG 2>&1 &
  echo $DOMINO_BIN -jc -q
  count=0
  java_controller_is_running
  while [ $? -eq 1 ] ; do
    sleep 10
    count=`expr $count + 1`
    if [ $count -eq 10 ] ; then
      # kill java controller and lock file
      cleanup_java_controller
    fi      
    java_controller_is_running
  done
}
function shutdown_broadcast_message
{
  if [ "$BROADCAST_SHUTDOWN_MESSAGE" = "yes" ] ; then
    $DOMINO_BIN -c ' BROADCAST "(!) Domino Server will be stopped now"' >> $DOMINO_OUTPUT_LOG 2>&1
  fi
}
# --- sanity check for server environment ---
# check if script is executed with root user
if [ "$DOMINO_USER" = "root" ]; then
  errmsg "Run the Domino Server as a notes user - exiting "
  exit 1
fi
# check rights to execute domino binaries
if [ ! -x $DOMINO_BIN ] ; then
  errmsg "Cannot access server command ($DOMINO_BIN) - exiting"
  exit 1
fi
# check notes-data directory
if [ ! -d $DOMINO_DATA_PATH ] ; then
  errmsg "Cannot access notes data directory ($DOMINO_DATA_PATH) - exiting"
  exit 1
fi
# check right to write to notes.ini
if [ ! -w $DOMINO_INI_PATH ] ; then
  errmsg "Cannot write to notes.ini ($DOMINO_INI_PATH) - exiting"
  exit 1
fi
if [ "$LINUX_DISTRIBUTION" = "suse" ] ; then
  # init suse rc
  . /etc/rc.status
  # reset status of this service
  rc_reset
else
  #dummy functions for non-suse platforms
  function rc_status
  {
    return 0
  }
  function rc_check
  {
    return 0
  }
  function rc_exit
  {
    return 0
  }
fi
# --- main script logic ---
case "$PARAM" in
  start)
    domino_is_running
    if [ $? -eq 1 ] ; then
      errmsg "Domino Server is already running - exiting"
      exit 1
    fi
    if [ -e $DOMINO_DATA_PATH/domino_disabled ] ; then
      errmsg "Domino Server is disabled for Maintenance"
      exit 1
    fi
    cd $DOMINO_DATA_PATH
    # cleanup
    # terminate java controlle before restarting domino server with java controller
    if [ "$USE_JAVA_CONTROLLER" = "yes" ] ; then
      java_controller_is_running
      if [ $? -eq 1 ] ; then
        shutdown_java_controller
      fi
    fi
  
    #empty the input file
    cat /dev/null > $DOMINO_INPUT_FILE
    # for servers using Notes passwords,
    # replace the previous line with the following line.
    # cat .secure_hidden_passwd > $DOMINO_INPUT_FILE
    # move log-file and compress it
    DOMINO_OUTPUT_LOG_BACKUP=$DOMINO_OUTPUT_LOG.`date +"%y%m%d_%H%M%S"`
    if [ -r $DOMINO_OUTPUT_LOG ] ; then
      mv $DOMINO_OUTPUT_LOG $DOMINO_OUTPUT_LOG_BACKUP >/dev/null
      $COMPRESS_COMMAND $DOMINO_OUTPUT_LOG_BACKUP >/dev/null &
    fi
     
    echo "Starting Domino for $PLATFORM_NAME ($DOMINO_SERVER)"
    echo "---- environment info ----" > $DOMINO_OUTPUT_LOG
    set >> $DOMINO_OUTPUT_LOG
    
    if [ ${LARCH} = "ibmpow" ]; then
      # AIX platform tuning parameters
      echo "---- ulimit soft info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a >> $DOMINO_OUTPUT_LOG
      echo "---- ulimit hard info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a -H >> $DOMINO_OUTPUT_LOG
      echo "---- no info ----" >> $DOMINO_OUTPUT_LOG
      no -a >> $DOMINO_OUTPUT_LOG
    fi
    if [ ${LARCH} = "sunspa" ]; then
      # Solaris platform tuning parameters
      echo "---- ulimit soft info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a >> $DOMINO_OUTPUT_LOG
      echo "---- ulimit hard info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a -H >> $DOMINO_OUTPUT_LOG
    fi
    if [ ${LARCH} = "linux" ]; then
      # Linux platform tuning parameters
      
      if [ -z "$Notes_SHARED_DPOOLSIZE" ]; then
        export Notes_SHARED_DPOOLSIZE=20971520
      fi
      echo "---- ulimit soft info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a >> $DOMINO_OUTPUT_LOG
      echo "---- ulimit hard info ----" >> $DOMINO_OUTPUT_LOG
      ulimit -a -H >> $DOMINO_OUTPUT_LOG
    fi
    echo "---- end of info messages ----" >> $DOMINO_OUTPUT_LOG
    echo >> $DOMINO_OUTPUT_LOG
    
    $DOMINO_BIN $JAVE_CONTROLLER_STRING < $DOMINO_INPUT_FILE >> $DOMINO_OUTPUT_LOG 2>&1 &
        
    echo "done PID is $!"
    
    # remember status and be verbose
    rc_status -v
    ;;
  archivelog)
    DOMINO_OUTPUT_LOG_BACKUP=$DOMINO_OUTPUT_LOG.`date +"%y%m%d_%H%M%S"`
    # copy log-file and compress
    if [ -r $DOMINO_OUTPUT_LOG ] ; then
      # copy log file
      cp $DOMINO_OUTPUT_LOG $DOMINO_OUTPUT_LOG_BACKUP >/dev/null
      
      # empty log file
      cat /dev/null > $DOMINO_OUTPUT_LOG
      echo "--- moved log file to '$DOMINO_OUTPUT_LOG_BACKUP' ---" >> $DOMINO_OUTPUT_LOG
      
      # compress log file
      $COMPRESS_COMMAND $DOMINO_OUTPUT_LOG_BACKUP >/dev/null
      echo "archived log file to '$DOMINO_OUTPUT_LOG_BACKUP'"
    else
      echo "no log file to archive"
    fi
      
    # remember status and be verbose
    rc_status -v
    ;;
  stop)
    echo "Stopping Domino for $PLATFORM_NAME ($DOMINO_SERVER)"
    echo " ... waiting for shutdown to complete"
    shutdown_broadcast_message
    shutdown_domino_server
    echo "Domino for $PLATFORM_NAME ($DOMINO_SERVER) shutdown completed"
   
    # remember status and be verbose
    rc_status -v
    ;;
  stopjc)
    # stop domino server before stoping java controller
    domino_is_running
    if [ $? -eq 1 ] ; then
      echo "Stopping Domino for $PLATFORM_NAME ($DOMINO_SERVER)"
      echo " ... waiting for shutdown to complete"
      shutdown_broadcast_message
      shutdown_domino_server
    fi
    echo "Stopping Java Controler for $PLATFORM_NAME ($DOMINO_SERVER)"
    shutdown_java_controller
    echo "Java Controler for $PLATFORM_NAME ($DOMINO_SERVER) shutdown completed"
   
    # remember status and be verbose
    rc_status -v
    ;;
  monitor)
  
    if [ ! -r $DOMINO_OUTPUT_LOG ] ; then
      errmsg "Cannot read server-log ($DOMINO_OUTPUT_LOG) - exiting"
      exit 1
    fi
    if [ ! -w $DOMINO_INPUT_FILE ] ; then
      errmsg "Cannot write server-input-file ($DOMINO_INPUT_FILE) - exiting"
      exit 1
    fi
  
    echo
    echo "--- Live Console for $DOMINO_SERVER ---"
    echo
    echo "To stop console, always ctrl+c."
    echo
    echo
    sleep 2
    tail -f $DOMINO_OUTPUT_LOG &
    MONITOR_PID=$!
    trap "stop_monitor" 1 2 3
    while true
    do
      read var
      echo $var >> $DOMINO_INPUT_FILE
    done
    ;;
  restart)
    # Stop the service and regardless of whether it was running or not, start it again.
    $0 stop "$2" "$3"
    $0 start "$2" "$3"
    # remember status and be quiet
    rc_status
    ;;
    
  fullnsd)
    # run NSD
    echo "Running full NSD for ($DOMINO_SERVER)"
    cd $DOMINO_DATA_PATH
    $NSD_BIN
    ;;
  nsd)
    # run NSD -nomemcheck
    echo "Running NSD -nomemcheck for ($DOMINO_SERVER)"
    cd $DOMINO_DATA_PATH
    $NSD_BIN -info
    ;;
 
  info)
    # run NSD -info
    echo "Running NSD -info for ($DOMINO_SERVER)"
    cd $DOMINO_DATA_PATH
    $NSD_BIN -info
    ;;
    
  kill)
    # run NSD -kill
    echo "Running NSD -kill for ($DOMINO_SERVER)"
    cd $DOMINO_DATA_PATH
    $NSD_BIN -kill
    ;;
    
  status)
    domino_status_check
    # remember status and be verbose
    rc_status -v
    ;;
  setenv)
    # just set the environment
    exit 0
    ;;
  test)
    set
    ;;
  *)
    usage
    exit 1
    ;;
esac
rc_exit
A másik fájlt az /etc/init.d -be kell tenni. A root futtatási joggal kell rendelkezzen a fájlra vonatkozóan. Az alábbi cuccot dobd át egy domino nevű fájlba
-------------------------------------------------------------------------------------------
#!/bin/sh
 ########################################################################
 # Start/Stop Script for Domino on xLinux/zLinux/AIX/Solaris
 # 2005 written by Daniel Nashed, feedback domino_unix@nashcom.de
 # Version 1.4 02.04.2006
 ########################################################################
 # chkconfig: 2345 66 19
 # description: Lotus Domino Server
 
 ### BEGIN INIT INFO
 # Provides: rc_domino
 # Required-Start: $remote_fs $syslog $network
 # Required-Stop:  $remote_fs $syslog 
 # Default-Start:  3 5
 # Default-Stop:   0 1 2 6
 # Short-Description: IBM Lotus Domino Server (notes)
 # Description:       IBM Lotus Domino Server (notes)
 #       Start/Stop Script for xLinux/zLinux/AIX/Solaris
 #       2005 written by Daniel Nashed (domino_unix@nashcom.de)
 
 ### END INIT INFO
 
 # set default user to "notes" if no user is specified
 if [ -z "$DOMINO_USER" ]; then
   DOMINO_USER=notes
 fi
 
 
 DOMINO_START_SCRIPT=/opt/ibm/lotus/rc_domino_script
 SWITCH_USER=0
 
 # starting a server always needs a switch to a separate run-time environment
 if [ "$LOGNAME" = "$DOMINO_USER" ] ; then
 
   if [ "$1" = "start" ] ; then
     SWITCH_USER=1
   fi
 
   if [ "$1" = "restart" ] ; then
     SWITCH_USER=1
   fi
 else
   SWITCH_USER=1
 fi
 
 if [ "$SWITCH_USER" = "0" ] ; then
   $DOMINO_START_SCRIPT "$1" 
 else
   echo switching to $DOMINO_USER
   su - $DOMINO_USER -c "$DOMINO_START_SCRIPT '$1' "
 fi
Ezt követően ki kell adni a következő parancsot, hogy a rendszer automatikusan elindítsa/leállítsa a dominot bootoláskor:
chkconfig domino on
Standard indítás linuxon - nemm boot időben:
service domino start
Leállítás: ugyanez a stop paraméterrel.
Amit kivettem goyrsan a script működéséből:
root userként beállít egy-két dolgot majd notes userre vált és meghívja az rc_domino_scriptet, mely már az új user ID alatt elindítja a server binaryt.
 
 
No comments:
Post a Comment