commit: 4f23be11c1a83020c2a4f4531afa6636f974ed2e parent: 14fd90fffab962a4123af80b9acbde62b890af2a Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me> Date: Thu, 26 Mar 2020 06:40:15 +0100 net-misc/yacy: Simplify the OpenRC filesDiffstat:
M | net-misc/yacy/files/yacy.confd | 20 | ++------------------ |
M | net-misc/yacy/files/yacy.rc | 79 | ++++++++++--------------------------------------------------------------------- |
2 files changed, 12 insertions(+), 87 deletions(-)
diff --git a/net-misc/yacy/files/yacy.confd b/net-misc/yacy/files/yacy.confd @@ -1,18 +1,2 @@ -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -# home-directory -YACY_HOME="/usr/share/yacy" - -# user to run yacy as -YACY_USER="yacy" - -# java options (optional) -JAVA_OPTIONS="-Xmx600m -Xms180m" - -# niceness (optional) -NICENESS="1" - -# wait on stop, should be maxWaitingWordFlush, see DATA/SETTINGS/httpProxy.conf -WAIT_ON_STOP="180" +# yacy/java options (optional) +yacy_options="-Xmx600m -Xms180m" diff --git a/net-misc/yacy/files/yacy.rc b/net-misc/yacy/files/yacy.rc @@ -1,75 +1,16 @@ #!/sbin/openrc-run -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ +supervisor=supervise-daemon +command=/usr/bin/java +command_args="phx.server" +command_args="${yacy_options} -server -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Dsolr.directoryFactsolr.MMapDirectoryFactory net.yacy.yacy" +command_user=yacy:yacy +command_background=1 +retry="SIGTERM/30/SIGKILL/5" +pidfile="/var/run/pleroma.pid" +directory="/usr/share/yacy" depend() { need net } -cd $YACY_HOME - -JAVA="$(java-config --java)" - -JAVA_ARGS="" -if [ -e 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 - -CLASSPATH="" -test -e lib/ && for N in `ls -1 lib/*.jar`; do CLASSPATH="$CLASSPATH$N:"; done -CLASSPATH="-classpath classes:htroot:$CLASSPATH" - -if [ -n "${NICENESS}" ] ; then - NICE="nice -n ${NICENESS}" -fi - -#PORT="8090" - -start() { - set -x - ebegin "Starting YaCy" - ${NICE} sudo -u ${YACY_USER} ${JAVA} ${JAVA_OPTIONS} ${JAVA_ARGS} ${CLASSPATH} net.yacy.yacy & - echo $! > /var/run/yacy.pid - sleep 1 - ps ax|grep "^ *$(cat /var/run/yacy.pid)" > /dev/null - eend $? -} - -stop() { - ebegin "Shutting down YaCy" - sudo -u ${YACY_USER} ${JAVA} ${JAVA_OPTIONS} ${JAVA_ARGS} ${CLASSPATH} net.yacy.yacy -shutdown &> /dev/null & - einfon "Waiting ." - cnt=0 - while ( ps ax|grep "^ *$(cat /var/run/yacy.pid)" > /dev/null ) - do - cnt=`expr $cnt + 2` - if [ $cnt -gt ${WAIT_ON_STOP} ] ; then - eend 1 "Failed." - exit - fi - sleep 2 - echo -n "." - done - rm /var/run/yacy.pid - echo "done." - eend $? -} - -status() { - if service_started "${myservice}" ; then - if ! ps p `cat /var/run/yacy.pid` &> /dev/null ; then - eerror "Service seems to be down" - return 1 - fi - else - if [ -e /var/run/yacy.pid ]; then - eerror "Service seems to be running already" - return 1 - fi - return 0 - fi -} +CLASSPATH=.:htroot:lib/*