Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

print-only option for use in other scripts.

allo4435d916d423
diff --git a/startYACY.sh b/startYACY.sh
index 2c9cab474..db33afc10 100755
--- a/startYACY.sh
+++ b/startYACY.sh
@@ -11,57 +11,108 @@ then
echo "Either you have not installed java or it is not in your PATH"
#echo "Has this script been invoked by CRON? Then use the -c option."
exit 1
+fi
- #-c to be imlemented.
- #Possible locations for setting of PATH
-
- #sh, ksh, bash, zsh
- #. ~/.profile
- #bash
- #. ~/.bash_profile
- #csh, tcsh
- #. ~/.login
- #sh, ksh, bash, zsh
- #. /etc/profile
- #csh, tcsh
- #. /etc/csh.login
-
-else
- #startup YaCy
- cd `dirname $0`
-
- #get javastart args
- java_args=""
- if [ -f DATA/SETTINGS/httpProxy.conf ]
- then
- for i in $(grep javastart DATA/SETTINGS/httpProxy.conf);
- do i="${i#javastart_*=}";java_args=-$i" "$java_args;
- done
+#-c to be imlemented.
+#Possible locations for setting of PATH
+
+#sh, ksh, bash, zsh
+#. ~/.profile
+#bash
+#. ~/.bash_profile
+#csh, tcsh
+#. ~/.login
+#sh, ksh, bash, zsh
+#. /etc/profile
+#csh, tcsh
+#. /etc/csh.login
+
+#startup YaCy
+cd `dirname $0`
+
+options=$(getopt -n YaCy -o d,l,p -- $@)
+if [ $? -ne 0 ];then
+ exit 1;
+fi
+
+isparameter=0; #options or parameter part of getopts?
+parameter="" #parameters will be collected here
+
+LOGGING=0
+DEBUG=0
+PRINTONLY=0
+for option in $options;do
+ if [ $isparameter -ne 1 ];then #option
+ if [ x$option == "x-l" ];then
+ LOGGING=1
+ if [ $DEBUG -eq 1 ];then
+ echo "can not combine -l and -d"
+ exit 1;
+ fi
+ elif [ x$option == "x-d" ];then
+ DEBUG=1
+ if [ $LOGGING -eq 1 ];then
+ echo "can not combine -l and -d"
+ exit 1;
+ fi
+ elif [ x$option == "x-p" ];then
+ PRINTONLY=1
+ fi #which option
+ else #parameter
+ if [ x$option == "--" ];then #option / parameter seperator
+ isparameter=1;
+ continue
+ else
+ parameter="$parameter $option"
+ fi
+ fi #parameter or option?
+done
+
+#echo $options;exit 0 #debug for getopts
+
+#get javastart args
+java_args=""
+if [ -f DATA/SETTINGS/httpProxy.conf ]
+then
+ for i in $(grep javastart DATA/SETTINGS/httpProxy.conf);do
+ i="${i#javastart_*=}";
+ JAVA_ARGS="-$i $JAVA_ARGS";
+ done
+fi
+
+# generating the proper classpath
+CLASSPATH=""
+for N in lib/*.jar; do CLASSPATH="$CLASSPATH$N:"; done
+for N in libx/*.jar; do CLASSPATH="$CLASSPATH$N:"; done
+
+
+cmdline="";
+if [ $DEBUG -eq 1 ] #debug
+then
+ if [ $PRINTONLY -eq 1 ];then
+ echo java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:$CLASSPATH yacy
+ else
+ java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:$CLASSPATH yacy
fi
-
- # generating the proper classpath
- CLASSPATH=""
- for N in lib/*.jar; do CLASSPATH="$CLASSPATH$N:"; done
- for N in libx/*.jar; do CLASSPATH="$CLASSPATH$N:"; done
-
- if [ "x$1" == "x-d" ] #debug
- then
- java $java_args -classpath classes:$CLASSPATH yacy
- exit 0
- elif [ "x$1" == "x-l" ] #logging
- then
- nohup java $java_args -classpath classes:htroot:$CLASSPATH yacy >> yacy.log &
+elif [ $LOGGING -eq 1 ];then #logging
+ if [ $PRINTONLY -eq 1 ];then
+ echo "java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:htroot:$CLASSPATH yacy >> yacy.log"
else
- nohup java $java_args -Djava.awt.headless=true -classpath classes:htroot:$CLASSPATH yacy > /dev/null &
-# nohup java -Xms160m -Xmx160m -classpath classes:htroot:$CLASSPATH yacy > /dev/null &
+ nohup java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:htroot:$CLASSPATH yacy >> yacy.log &
+ fi
+else
+ if [ $PRINTONLY -eq 1 ];then
+ echo "java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:htroot:$CLASSPATH yacy > /dev/null"
+ else
+ nohup java $JAVA_ARGS -Djava.awt.headless=true -classpath classes:htroot:$CLASSPATH yacy > /dev/null &
+ #nohup java -Xms160m -Xmx160m -classpath classes:htroot:$CLASSPATH yacy > /dev/null &
+ echo "****************** YaCy Web Crawler/Indexer & Search Engine *******************"
+ echo "**** (C) by Michael Peter Christen, usage granted under the GPL Version 2 ****"
+ echo "**** USE AT YOUR OWN RISK! Project home and releases: http://yacy.net/yacy ****"
+ echo "** LOG of YaCy: DATA/LOG/yacy00.log (and yacy<xx>.log) **"
+ echo "** STOP YaCy: execute stopYACY.sh and wait some seconds **"
+ echo "** GET HELP for YaCy: see www.yacy-websearch.net/wiki and www.yacy-forum.de **"
+ echo "*******************************************************************************"
+ echo " >> YaCy started as daemon process. Administration at http://localhost:8080 <<"
fi
- echo "****************** YaCy Web Crawler/Indexer & Search Engine *******************"
- echo "**** (C) by Michael Peter Christen, usage granted under the GPL Version 2 ****"
- echo "**** USE AT YOUR OWN RISK! Project home and releases: http://yacy.net/yacy ****"
- echo "** LOG of YaCy: DATA/LOG/yacy00.log (and yacy<xx>.log) **"
- echo "** STOP YaCy: execute stopYACY.sh and wait some seconds **"
- echo "** GET HELP for YaCy: see www.yacy-websearch.net/wiki and www.yacy-forum.de **"
- echo "*******************************************************************************"
- echo " >> YaCy started as daemon process. Administration at http://localhost:8080 <<"
-
fi