diff options
-rwxr-xr-x | admin/Sources/Services/opengnsys.init | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/admin/Sources/Services/opengnsys.init b/admin/Sources/Services/opengnsys.init index aa82f783..2125e187 100755 --- a/admin/Sources/Services/opengnsys.init +++ b/admin/Sources/Services/opengnsys.init @@ -14,6 +14,9 @@ # Definiciones globales # BASEDIR=/opt/opengnsys +OPENGNSYSUSER="opengnsys" +IMAGEDIR=$BASEDIR/images +CLIENTLOGDIR=$BASEDIR/log/clients # # Servidor de OpenGnSys @@ -35,7 +38,7 @@ REPODAEMON_OPTIONS="-f $REPOCFG -l $REPOLOG" ############## ADV REPOAUXNAME=ogAdmRepoAux REPOAUXDAEMON=$BASEDIR/sbin/$REPOAUXNAME -REPOAUXPORT=$((`cat $SERVERCFG | grep PUERTO | cut -f2 -d"="` + 1)) +REPOAUXPORT=$(awk -F= '/PUERTO/ {print $2+1}' $SERVERCFG 2>/dev/null) ############## ADV # @@ -55,9 +58,9 @@ BTTRACK=/usr/bin/bttrack.bittorrent BTSEEDER=/usr/bin/btlaunchmany.bittornado BTTRACKPORT=6969 BTTRACKDFILE=/tmp/dstate -BTTRACKLOG=/opt/opengnsys/log/bttrack.log +BTTRACKLOG=$BASEDIR/log/bttrack.log BTINTERVAL=30 -BTTORRENTSDIR=/opt/opengnsys/images +BTTORRENTSDIR=$BASEDIR/images BTALLOW_GET=1 BTTRACK_OPTIONS=" --port $BTTRACKPORT --dfile $BTTRACKDFILE --reannounce_interval $BTINTERVAL --logfile $BTTRACKLOG --allowed_dir $BTTORRENTSDIR --allow_get $BTALLOW_GET --parse_allowed_interval 1" BTTRACKPID="/var/run/bttrack.pid" @@ -103,6 +106,24 @@ config() { } arranca_demonios() { + # Comprobar que está instalado OpenGnSys. + if [ ! -d $BASEDIR ]; then + $ACTIONMSG "ERROR: No existe el directorio $BASEDIR" + $FAILMSG + exit $? + fi + # Verificar permisos básicos. + if [ "$(stat --printf="%A%G" $IMAGEDIR 2>/dev/null)" != "drwxrwxr-x$OPENGNSYSUSER" ]; then + mkdir $IMAGEDIR 2>/dev/null + chmod 775 $IMAGEDIR + chgrp $OPENGNSYSUSER $IMAGEDIR + fi + if [ "$(stat --printf="%A%G" $CLIENTLOGDIR 2>/dev/null)" != "drwxrwxr-x$OPENGNSYSUSER" ]; then + mkdir -p $CLIENTLOGDIR 2>/dev/null + chmod 775 $CLIENTLOGDIR + chgrp $OPENGNSYSUSER $CLIENTLOGDIR + fi + # Arrancar los servicios indicados. if [ $RUN_OGADMSERVER = "yes" ] then $ACTIONMSG "Iniciando demonio: $SERVERNAME" @@ -197,3 +218,4 @@ case "$1" in esac exit 0 + |