linux - Symbols in startup.sh of Apache Tomcat -


i've been trying make own 'daemon' java thread.

i couldn't quite wanted, got curious how tomcat stays alive after disconnect ssh connection.

so decided poke around tomcat source files, see if find 'the magic'.
in startup.sh there weird looking things tried find on internet without luck.

in startup.sh

    # resolve links - $0 may softlink prg="$0"  while [ -h "$prg" ] ;   ls=`ls -ld "$prg"`   link=`expr "$ls" : '.*-> \(.*\)$'`   if expr "$link" : '/.*' > /dev/null;     prg="$link"   else     prg=`dirname "$prg"`/"$link"   fi done  prgdir=`dirname "$prg"` executable=catalina.sh  # check target executable exists if $os400;   # -x work on os400 if files are:    # 1. owned user   # 2. owned primary group of user   # not work if user belongs in secondary groups   eval else   if [ ! -x "$prgdir"/"$executable" ];     echo "cannot find $prgdir/$executable"     echo "the file absent or not have execute permission"     echo "this file needed run program"     exit 1   fi fi   exec "$prgdir"/"$executable" start "$@" 
  1. what '$0' ?
  2. what's '$@' ?

what ?
edit
perhaps doesn't have oq wanted share i've found.
after analysing source code of apache tomcat, figured out. i'm not sure if how tomcat runs.
wanted daemon process.
first need launcher written in java. within launcher, make process , exec("java yourdaemontobe");
hope helps.

the name of shell-script running $0, argv found in array $@, i.e. command line arguments script.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -