Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:56:18+00:00 2026-06-09T15:56:18+00:00

I am trying to run script file of opensource chat server freecs(http://freecs.sourceforge.net/) named freecs.sh.

  • 0

I am trying to run script file of opensource chat server freecs(http://freecs.sourceforge.net/) named freecs.sh. When I run the file with ./freecs.sh I get following : bash: ./freecs.sh: /bin/sh^M: bad interpreter: No such file or directory
even if the file exists in the same directory. When I try to run it with bash freecs.sh I get this: freecs.sh: line 12: $’\r’: command not found

freecs.sh: line 16: $'\r': command not found
freecs.sh: line 19: $'\r': command not found
freecs.sh: line 22: $'\r': command not found
freecs.sh: line 30: $'\r': command not found
freecs.sh: line 33: $'\r': command not found
freecs.sh: line 36: $'\r': command not found
freecs.sh: line 40: $'\r': command not found
freecs.sh: line 43: $'\r': command not found
freecs.sh: line 49: $'\r': command not found
freecs.sh: line 50: like: command not found
freecs.sh: line 51: syntax error near unexpected token `$'{\r''
'reecs.sh: line 51: `echo_failure() {

I already tried chmod +x freecs.sh and then running the script but did not help. The file looks like below:

#!/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/java/j2sdk1.4.1_02
export JAVA_HOME=/user/local/java/jdk1.6.0_33

# 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=/usr/local/freecs
export FREECS_HOME=/home/Applications/freecs-1.3.20111225
FREECS_BIN=java
FREECS_STARTUP_LOG=/var/log/freecs/freecs_startup.log
FREECS_PID=/var/run/freecs.pid
FREECS_USER=root

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

JARS=$JARS:$FREECS_HOME/lib/xmlrpc/commons-codec-1.4.jar
JARS=$JARS:$FREECS_HOME/lib/xmlrpc/commons-httpclient-3.1.jar

JARS=$JARS:$FREECS_HOME/lib/xmlrpc/xmlrpc-common-3.1.3.jar
JARS=$JARS:$FREECS_HOME/lib/xmlrpc/xmlrpc-client-3.1.3.jar
JARS=$JARS:$FREECS_HOME/lib/xmlrpc/xmlrpc-server-3.1.3.jar

JARS=$JARS:$FREECS_HOME/lib/xmlrpc/commons-logging-1.1.jar
JARS=$JARS:$FREECS_HOME/lib/xmlrpc/ws-commons-util-1.0.2.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

Can anyone please tell me why freecs.sh does not find the file ? and with bash freecs.sh why I get an error ? MY java home dir is set properly.

Thnaks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:56:20+00:00Added an answer on June 9, 2026 at 3:56 pm

    That is because your file has dos style newline symbols.

    Run

    dos2unix freecs.sh
    

    and then runs it as usual.

    If dos2unix isn’t installed you can try instead of it:

    sed -i 's/\r//g' freecs.sh
    

    ps. to prevent such errors in the future you can always check such symbols with sed -n l filename.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've Google around and haven't found much... I'm trying to run script/server for my
I am trying to run a script remotely (from a bash script), but am
I'm trying to run a test script using crontab within Plesk. The php file
I am trying to run this script mail.pl #!/usr/bin/perl print Content-type: text/html \n\n; #HTTP
I'm trying to run a bash script in linux (ubuntu but also fedora) but
I'm trying to run a bash script using shell_exec but It doesnt seem to
I am trying to run a shell script from within a .vimrc file (three
I using a new server (Rackspace, Ubuntu 10.04) trying to run a php file
I am trying to run a python script which uses a binary file (xFiles.bin.addr_patched)
I am trying to run the following script from my usercontrol: <script type=text/javascript language=javascript>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.