diff --git a/docker/Dockerfile b/docker/Dockerfile index 0c1d0584f..0de3ea251 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,5 +52,5 @@ VOLUME ["/opt/yacy_search_server/DATA"] # Next commands run as yacy as non-root user for improved security USER yacy -# Start yacy in debug mode (-d) to display console logs and to wait for yacy process -CMD ["/bin/sh","/opt/yacy_search_server/startYACY.sh","-d"] +# Start yacy as a foreground process (-f) to display console logs and to wait for yacy process +CMD ["/bin/sh","/opt/yacy_search_server/startYACY.sh","-f"] diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index bcc2dd96d..d5dbe92df 100755 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -84,5 +84,5 @@ VOLUME ["/opt/yacy_search_server/DATA"] # Next commands run as yacy as non-root user for improved security USER yacy -# Start yacy in debug mode (-d) to display console logs and to wait for yacy process -CMD ["/bin/sh","/opt/yacy_search_server/startYACY.sh","-d"] +# Start yacy as a foreground process (-f) to display console logs and to wait for yacy process +CMD ["/bin/sh","/opt/yacy_search_server/startYACY.sh","-f"] diff --git a/startYACY.sh b/startYACY.sh index eea089f01..a6ebf88e2 100755 --- a/startYACY.sh +++ b/startYACY.sh @@ -38,7 +38,8 @@ Options -h, --help show this help -t, --tail-log show the output of "tail -f DATA/LOG/yacy00.log" after starting YaCy -l, --logging save the output of YaCy to yacy.log - -d, --debug show the output of YaCy on the console + -d, --debug show the output of YaCy on the console and enable remote monitoring with JMX + -f, --foreground run as a foreground process, showing the output of YaCy on the console -p, --print-out only print the command, which would be executed to start YaCy -s, --startup [data-path] start YaCy using the specified data folder path, relative to the current user home -g, --gui start a gui for YaCy @@ -57,7 +58,7 @@ then options="`getopt hdlptsg: $*`" else - options="`getopt -n YaCy -o h,d,l,p,t,s,g -l help,debug,logging,print-out,tail-log,startup,gui -- $@`" + options="`getopt -n YaCy -o h,d,f,l,p,t,s,g -l help,debug,foreground,logging,print-out,tail-log,startup,gui -- $@`" fi if [ $? -ne 0 ];then @@ -70,6 +71,7 @@ parameter="" #parameters will be collected here LOGGING=0 DEBUG=0 +FOREGROUND=0 PRINTONLY=0 TAILLOG=0 STARTUP=0 @@ -87,6 +89,10 @@ for option in $options;do echo "can not combine -l and -d" exit 1; fi + if [ $FOREGROUND -eq 1 ];then + echo "can not combine -l and -f" + exit 1; + fi ;; -d|--debug) DEBUG=1 @@ -97,6 +103,13 @@ for option in $options;do exit 1; fi ;; + -f|--foreground) + FOREGROUND=1 + if [ $LOGGING -eq 1 ];then + echo "can not combine -l and -f" + exit 1; + fi + ;; -p|--print-out) PRINTONLY=1 ;; @@ -209,6 +222,8 @@ fi if [ $DEBUG -eq 1 ] #debug then cmdline=$cmdline +elif [ $FOREGROUND -eq 1 ];then # foreground process without remote JMX monitoring + cmdline=$cmdline elif [ $LOGGING -eq 1 ];then #logging cmdline="$cmdline >> yacy.log & echo \$! > $PIDFILE" else @@ -228,6 +243,9 @@ else then # with exec the java process become the main process and will receive signals such as SIGTERM exec $cmdline + elif [ $FOREGROUND -eq 1 ];then # foreground process without remote JMX monitoring + # with exec the java process become the main process and will receive signals such as SIGTERM + exec $cmdline else echo " >> YaCy started as daemon process. Administration at http://localhost:$PORT << " eval $cmdline