Hello,
I had problem with starting LSC on Solaris 10. I had to do some changes
in startup script. Solaris using slight different version of ps and grep
command, and 'which' always return with 0 exit code. Updated version in
attachement. Changes are made in line 130 and 146-149.

Regards
-- 
Jakub Skory, <kuba(at)ukw(dot)edu(dot)pl>
System Operator
IT Center:
_______________________________________________________________________
tel:             +48 52 3257 649,  +48 52 3257 647
fax:             +48 52 3257 646,  +48 52 3257 647
working hours:    08a.m. - 04p.m.
mail:             di(at)ukw(dot)edu(dot)pl
web:              http://di.ukw.edu.pl/
postal address:   M. Kopernika 1 (room 8/9), 85-074, Bydgoszcz.
_______________________________________________________________________
Kazimierz Wielki University,
J. K. Chodkiewicza 30,
85-064, Bydgoszcz, Poland.
_______________________________________________________________________
#!/bin/bash

#====================================================================
# Script for LDAP Synchronization Connector
#
# Launch synchronize task with correct classpath
#
#                  ==LICENSE NOTICE==
#
# Copyright (c) 2008-2010, LSC Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

#￯﾿﾿￯﾿﾿ ￯﾿﾿￯﾿﾿ * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# ￯﾿﾿￯﾿﾿ ￯﾿﾿￯﾿﾿ * Redistributions in binary form must reproduce the above 
copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# ￯﾿﾿￯﾿﾿ ￯﾿﾿￯﾿﾿ * Neither the name of the LSC Project nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#                  ==LICENSE NOTICE==
#
#                (C) 2008-2010 LSC Project
#             Clement OUDOT <[email protected]>
#             Jonathan CLARKE <[email protected]>
#
#====================================================================
# Possible exit codes:
#       - 0: success, LSC finished running
#       - 1: LSC seems to be already running, aborting
#       - 2: 'java' executable not found on PATH or in JAVA_HOME, aborting
#====================================================================


#====================================================================
# Changelog
#====================================================================
# Version 0.5 (09/2011):
# - Add the JAVA_OPTS environment variable usage
# Version 0.4 (01/2010):
# - Include a fatal error message in JAVA_HOME missing
# - Notice log file location
# Version 0.3 (01/2010):
# - Update for LSC 1.2
# - Guess the base directory for LSC and usual directories
# - Use JAVA_HOME from the environment or java on PATH, without redefining it
# Version 0.2 (2008):
# - Modify exit codes
# - Add comments
# Author: Clement OUDOT (LINAGORA)
#
# Version 0.1 (2008):
# - First version
# Author: Jonathan CLARKE (LINAGORA)
#====================================================================

# work out where LSC lives
LSC_HOME=$(dirname "${BASH_SOURCE}")/..
if [ ${LSC_HOME:0:1} != "/" ] ; then
        LSC_HOME="${PWD}/${LSC_HOME}"
fi

#====================================================================
# Configuration
#====================================================================

CFG_DIR="$LSC_HOME/etc"
LIB_DIR="$LSC_HOME/lib"
LOG_DIR="/tmp"
LOG_FILE="$LOG_DIR/lsc.log"

mkdir -p "$LOG_DIR"

#====================================================================
# Functions
#====================================================================
function log() {
        echo "$(date "+${DATE_FORMAT:-%Y/%m/%d %T}") [lsc] $1" >> "$LOG_FILE"
}

function fatal() {
        log $1
        echo "$(date "+${DATE_FORMAT:-%Y/%m/%d %T}") [lsc] $1" 1>&2
}

# Determine where the java exectuable is
function get_java() {
        # Do we have a JAVA_HOME environment variable?
        if [ "z" != "z${JAVA_HOME}" ]; then
                JAVA_COMMAND="${JAVA_HOME}/bin/java"
                return
        fi

        # Try java command on PATH as an alternative
        JAVA_COMMAND="$(which java)"
        if [ $? -eq 0 ]; then return; fi

        # Nothing seems approprite, warn and exit
        fatal "No java executable found on PATH or in JAVA_HOME! Aborting."
        fatal "Define JAVA_HOME or adjust your PATH variable to include java."
        exit 2
}

function build_classpath() {
        # Force SLF4J API library before anything else !
        CLASSPATH="$CLASSPATH:.:$(ls $LIB_DIR/slf4j-api*.jar)"
        for jar in "$LIB_DIR"/*.jar
        do
                CLASSPATH="$CLASSPATH:$jar"
        done

        # is this Cygwin? if so, convert path to Windows format for the JVM
        CYGPATH_COMMAND="$(which cygpath > /dev/null 2>&1)"
        if [ -e CYGPATH_COMMAND ]; then # which return 0 exit code on solaris, 
always!
                CLASSPATH=$(cygpath -p -w "$CLASSPATH")
        fi

        export CLASSPATH
}

#====================================================================
# Main
#====================================================================

# check if we have java executable
get_java

# check if LSC is not already running
# fix for SunOS
[ `uname` == "SunOS" ] \
        && LSC_PS_COUNT=`/usr/ucb/ps wwaux | grep org.lsc.Launcher | grep -v 
grep |wc -l` \
        || LSC_PS_COUNT=`ps aux | grep -a org.lsc.Launcher | grep -av grep | wc 
-l`;
if (( $LSC_PS_COUNT != 0 ))
then
        # LSC already running
        fatal "LSC already running - launch aborted"

        # since LSC already running, don't launch and exit
        exit 1
fi

# LSC not already running
log "Starting LSC"

build_classpath
"${JAVA_COMMAND}" -cp "$CLASSPATH" $JAVA_OPTS org.lsc.Launcher $*

status=$?

# LSC finished running
log "LSC finished running"

if [ $status -ne 0 ]
then
        echo "Last log file line: `tail -2 "$LOG_FILE" | head -1`" 1>&2
        exit $status
fi

#====================================================================
# Exit
#====================================================================
exit 0

Attachment: pgpvAmKmL6W0M.pgp
Description: PGP signature

www(dot)ukw(dot)edu(dot)pl

MID: 380664
13:31:59 07/13/12
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to