From 659542febe9a554a855e843d813a62bec3497560 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 21 Apr 2020 13:42:21 +0200 Subject: #971 Remove ogAdmAgent initialization All the functionalities of the ogAdmAgent are now in the ogAdmServer. So, the it is not needed anymore. This commit remove the installation and update of the ogAdmAgent, adds a check to remove it if exists and removes it from the OpenGnsys init script. A future patch will remove all the code related to the ogAdmAgent. --- admin/Sources/Services/opengnsys.default | 2 -- admin/Sources/Services/opengnsys.init | 20 -------------------- installer/opengnsys_installer.sh | 15 --------------- installer/opengnsys_update.sh | 19 ++++++++----------- server/bin/checkperms | 2 -- server/bin/setserveraddr | 4 ++-- 6 files changed, 10 insertions(+), 52 deletions(-) diff --git a/admin/Sources/Services/opengnsys.default b/admin/Sources/Services/opengnsys.default index d7376cf1..085d779f 100644 --- a/admin/Sources/Services/opengnsys.default +++ b/admin/Sources/Services/opengnsys.default @@ -1,6 +1,5 @@ # RUN_OGADMSERVER defined as OpenGnsys Admin Server # RUN_OGADMREPO defined as OpenGnsys Repository Manager -# RUN_OGADMAGENT run task scheduler service, only if Admin Server is enabled # RUN_BTTRACKER run Bittorrent Tracker, only if Repository is enabled # RUN_BTSEEDER start seeding of selected torrent files, only if Repository is enabled # BTSEEDER_PRIORITY nice priority to seed torrent files; recommended values: @@ -9,7 +8,6 @@ # -8 for Repo with Torrent RUN_OGADMSERVER="yes" RUN_OGADMREPO="yes" -RUN_OGADMAGENT="yes" RUN_BTTRACKER="yes" RUN_BTSEEDER="yes" BTSEEDER_PRIORITY=0 diff --git a/admin/Sources/Services/opengnsys.init b/admin/Sources/Services/opengnsys.init index ae27593b..ef5a5b8c 100755 --- a/admin/Sources/Services/opengnsys.init +++ b/admin/Sources/Services/opengnsys.init @@ -41,15 +41,6 @@ SERVERAUXDAEMON=$BASEDIR/sbin/$SERVERAUXNAME SERVERAUXPORT=2011 ############# IRINA -# -# Servidor de tareas programadas -# -AGENTNAME=ogAdmAgent -AGENTDAEMON=$BASEDIR/sbin/$AGENTNAME -AGENTCFG=$BASEDIR/etc/$AGENTNAME.cfg -AGENTLOG=$BASEDIR/log/$AGENTNAME.log -AGENTDAEMON_OPTIONS="-f $AGENTCFG -l $AGENTLOG" - # # Opciones Bittorrent # @@ -155,14 +146,6 @@ arranca_demonios() { faucet $REPOAUXPORT --daemon --in bash -c "$REPOAUXDAEMON" [ $? = 0 ] && $SUCCESSMSG || $FAILMSG fi - if [ $RUN_OGADMSERVER = "yes" ] && [ $RUN_OGADMAGENT = "yes" ]; then - sleep 5 # Damos tiempo a que ogAdmServer este funcionando - fi - if [ $RUN_OGADMAGENT = "yes" ]; then - $ACTIONMSG "Iniciando demonio: $AGENTNAME" - $DAEMONSTART $AGENTDAEMON $EXTRAOPTS $AGENTDAEMON_OPTIONS $ENDOPTS - [ $? = 0 ] && $SUCCESSMSG || $FAILMSG - fi if [ $RUN_BTTRACKER = "yes" ]; then $ACTIONMSG "Iniciando demonio: $BTTRACK" $TRACKERSTART $BTTRACK $EXTRAOPTS $BTTRACK_OPTIONS $ENDOPTS @@ -189,9 +172,6 @@ para_demonios() { [ $? = 0 ] && $SUCCESSMSG || $FAILMSG rm -f $BTTRACKPID fi - $ACTIONMSG "Parando demonio: $AGENTNAME" - $DAEMONSTOP $AGENTNAME - [ $? = 0 ] && $SUCCESSMSG || $FAILMSG $ACTIONMSG "Parando demonio: $REPOAUXNAME" pkill faucet [ $? -le 1 ] && $SUCCESSMSG || $FAILMSG diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 9954c53d..2553ab76 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1334,15 +1334,6 @@ function servicesCompilation () hayErrores=1 fi popd - # Compilar OpenGnsys Agent - echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Agent" - pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent - make && mv ogAdmAgent $INSTALL_TARGET/sbin - if [ $? -ne 0 ]; then - echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Agent" - hayErrores=1 - fi - popd return $hayErrores } @@ -1499,11 +1490,6 @@ function openGnsysConfigure() $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer/ogAdmServer.cfg > $INSTALL_TARGET/etc/ogAdmServer-$dev.cfg sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ $WORKDIR/opengnsys/repoman/etc/ogAdmRepo.cfg.tmpl > $INSTALL_TARGET/etc/ogAdmRepo-$dev.cfg - sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ - -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ - -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ - -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ - $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent/ogAdmAgent.cfg > $INSTALL_TARGET/etc/ogAdmAgent-$dev.cfg CONSOLEURL="https://${SERVERIP[i]}/opengnsys" sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ @@ -1520,7 +1506,6 @@ function openGnsysConfigure() done ln -f $INSTALL_TARGET/etc/ogAdmServer-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmServer.cfg ln -f $INSTALL_TARGET/etc/ogAdmRepo-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmRepo.cfg - ln -f $INSTALL_TARGET/etc/ogAdmAgent-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmAgent.cfg ln -f $INSTALL_TARGET/www/controlacceso-$DEFAULTDEV.php $INSTALL_TARGET/www/controlacceso.php # Configuración del motor de clonación. diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 21587723..8ca4dfff 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -55,8 +55,6 @@ fi # Cargar configuración de acceso a la base de datos. if [ -r $INSTALL_TARGET/etc/ogAdmServer.cfg ]; then source $INSTALL_TARGET/etc/ogAdmServer.cfg -elif [ -r $INSTALL_TARGET/etc/ogAdmAgent.cfg ]; then - source $INSTALL_TARGET/etc/ogAdmAgent.cfg fi OPENGNSYS_DATABASE=${OPENGNSYS_DATABASE:-"$CATALOG"} # Base de datos OPENGNSYS_DBUSER=${OPENGNSYS_DBUSER:-"$USUARIO"} # Usuario de acceso @@ -972,7 +970,11 @@ function updateServerFiles() if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys 2>/dev/null; then echoAndLog "${FUNCNAME}(): updating new init file" backupFile /etc/init.d/opengnsys + service="opengnsys" + $STOPSERVICE cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys + systemctl daemon-reload + $STARTSERVICE NEWFILES="$NEWFILES /etc/init.d/opengnsys" fi if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys >/dev/null; then @@ -1056,15 +1058,10 @@ function compileServices() popd # Parar antiguo servicio de repositorio. pgrep ogAdmRepo > /dev/null && service="ogAdmRepo" $STOPSERVICE - # Compilar OpenGnsys Agent - echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Server Agent" - pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent - make && moveNewService ogAdmAgent $INSTALL_TARGET/sbin - if [ $? -ne 0 ]; then - echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server Agent" - hayErrores=1 - fi - popd + # Remove OpenGnsys Agent (ogAdmAgent) + echoAndLog "${FUNCNAME}(): deleting deprecated OpenGnsys Agent" + [ -e $INSTALL_TARGET/sbin/ogAdmAgent ] && \ + rm -f $INSTALL_TARGET/sbin/ogAdmAgent # Compilar OpenGnsys Client echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Client" diff --git a/server/bin/checkperms b/server/bin/checkperms index b7559e84..c03f88bf 100755 --- a/server/bin/checkperms +++ b/server/bin/checkperms @@ -48,8 +48,6 @@ chown -R $OPENGNSYS_USER:$OPENGNSYS_USER $OPENGNSYS_DIR/client/etc/ssl/private chmod -R go-rwx $OPENGNSYS_DIR/client/etc/ssl/private chown $OPENGNSYS_USER:$OPENGNSYS_USER $OPENGNSYS_DIR/client/interfaceAdm/CambiarAcceso chmod 700 $OPENGNSYS_DIR/client/interfaceAdm/CambiarAcceso -chown root:root $OPENGNSYS_DIR/etc/ogAdmAgent*.cfg -chmod 600 $OPENGNSYS_DIR/etc/ogAdmAgent*.cfg chown root:$APACHE_GROUP $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg,etc/ogAdmServer*.cfg} chmod 640 $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg,etc/ogAdmServer*.cfg} chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/images/{fotos,iconos} diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr index c3898724..c7920e6a 100755 --- a/server/bin/setserveraddr +++ b/server/bin/setserveraddr @@ -33,7 +33,7 @@ source $OPENGNSYS/lib/ogfunctions.sh || exit 1 [ "$USER" != "root" ] && raiseError access "Need to be root" [ $# -ne 1 ] && raiseError usage [ -r $DEFAULTFILE ] || raiseError access "Cannot read default configuration file" -for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php,client/ogClient/cfg/ogclient.cfg}; do +for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo}.cfg,www/controlacceso.php,client/ogClient/cfg/ogclient.cfg}; do [ -w $f ] || raiseError access "Cannot write to file: $f" done @@ -88,7 +88,7 @@ if [ -n "$SERVERIP" ]; then OLDSERVERIP=$ServidorAdm # Checking if configuration files need to be modified. CHANGE=0 - for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php}; do + for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo}.cfg,www/controlacceso.php}; do # Updating configuration variables (if URL does not contain "localhost"). sed -e "s,\(ServidorAdm\|IPlocal\)=.*,\1=$SERVERIP," \ -e "s,^INTERFACE=.*,INTERFACE=$SERVERDEV," \ -- cgit v1.2.3-18-g5258