Find the answer to your Linux question:
Results 1 to 2 of 2
I fairly new to linux and loving fed10 . am currently having problem running the following script for free chat server see: FreeCS any help will be appreciated: #!/bin/sh # ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    2

    FreeCS

    I fairly new to linux and loving fed10 .
    am currently having problem running the following script for free chat server
    see: FreeCS
    any help will be appreciated:

    #!/bin/sh

    #

    # FreeCS startup script

    # for RedHat

    #

    # chkconfig: 345 90 20

    # description: FreeCS startup script

    # processname: java

    # pidfile: /var/run/freecs.pid



    # Source function library.

    . /etc/rc.d/init.d/functions



    # set this to the directory where your JVM is installed

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0



    # this sets the locales for java

    export LANG="de_DE@euro:de_DE:de"



    # setting environment for freecs

    export PATH=$PATH:$JAVA_HOME/bin



    # fill in the directory where you installed freecs

    export FREECS_HOME=/home/al/Desktop/freecs

    FREECS_BIN=/home/al/Desktop/freecs

    FREECS_STARTUP_LOG=/var/log/freecs/freecs_startup.log

    FREECS_PID=/var/run/freecs.pid

    FREECS_USER=al


    JARS=$CLASSPATH:$FREECS_HOME/lib/freecs.jar:$FREECS_HOME/lib/xmlrpc-1.2-b1.jar

    # if sql-authentication is used, you will have to insert

    # the path to your jdbc-driver here

    # JARS=$JARS:$FREECS_HOME/lib/ext/mysql.jar

    export CLASSPATH=$JARS

    RETVAL=0



    #like functions from /etc/rc.d/init.d/functions

    echo_failure() {

    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL

    echo -n "["

    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE

    if [ -z "$1" ]; then

    echo -n "FAILED"

    else

    echo -n "$1"

    fi

    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL

    echo -n "]"

    echo -ne "\r"

    return 1

    }





    startfreecs() {

    gotbase=

    user=

    case $1 in

    '') echo '$0: Usage: startfreecs [--user] {program}'

    return 1;;

    --user)

    shift

    daemon_user=$1

    shift

    ;;

    esac



    # Save basename.

    [ -z $gotbase ] && base=`basename $1`



    # make sure it doesn't core dump anywhere;

    # while this could mask

    # problems with the daemon,

    # it also closes some security problems

    ulimit -c 0



    # Echo daemon

    [ "$BOOTUP" = "verbose" ] && echo -n " $base"



    # Set the maximum filedescriptors a little bit higher

    # on heavy usage, this may go up a little bit (every network

    # connection is one filedescriptor)

    ulimit -n 8192



    # And start it up.

    if [ -z "$daemon_user" ]; then

    $* >$FREECS_STARTUP_LOG &

    hpid=$!

    else

    touch $FREECS_STARTUP_LOG

    su $daemon_user -c "$*" 2>/dev/null >$FREECS_STARTUP_LOG &

    hpid=$!

    fi

    /bin/ps h $hpid >/dev/null 2>&1 \

    && success "$base startup" || failure "$base startup"

    echo $hpid >$FREECS_PID



    }



    # See how we were called.

    case "$1" in

    start)

    # check if freecs is already running - if not, start it

    echo -n "Starting FreeCS:"

    DATE=`date +%Y%m%d_%H%M_%S`

    cp /var/log/freecs/*.log /var/log/freecs/*.$DATE

    if [ ! -f /var/lock/subsys/freecs ]; then

    startfreecs --user $FREECS_USER $JAVA_HOME/bin/$FREECS_BIN -server -Xms128m -Xmx768m \

    -cp $JARS freecs.Server -b=$FREECS_HOME



    RETVAL=$?

    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/freecs

    else

    if [ -f $FREECS_PID ]; then

    echo_failure "ALREADY RUNNING"

    else

    echo_failure "DEAD"

    fi

    fi

    echo

    ;;

    stop)

    echo -n "Shutting down FreeCS:"

    if [ -f $FREECS_PID ] ; then

    pid=`head -1 $FREECS_PID`

    kill -SIGTERM $pid && echo_success

    else

    echo_failure "NOT RUNNING"

    fi

    rm -f $FREECS_PID

    rm -f /var/lock/subsys/freecs



    echo

    ;;

    status)

    pid=`pidof -o $$ -o $PPID -o %PPID -x $FREECS_BIN`

    if [ "$pid" != "" ] ; then

    echo "FreeCS is running ($pid)"

    else

    echo "FreeCS is stopped"

    fi

    RETVAL=$?

    ;;

    restart)

    $0 stop

    sleep 20

    $0 start

    ;;

    *)

    echo "Usage: $0 {start|stop|status|restart}"

    exit 1

    esac



    exit $RETVAL

  2. #2
    Just Joined!
    Join Date
    Feb 2009
    Posts
    2
    here is what i get:

    [kay@localhost freecs]$ bash freecs.sh
    : command not found
    : No such file or directory.d/init.d/functions
    : command not found
    : command not found
    : command not found
    : command not found
    : command not found java
    : command not found
    : command not found
    'reecs.sh: line 38: syntax error near unexpected token `{
    'reecs.sh: line 38: `echo_failure() {

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...