summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2012-03-15 13:14:19 +0000
committerramon <ramongomez@us.es>2012-03-15 13:14:19 +0000
commite3d8dd1a0efd03116e09cb322694201adde96a68 (patch)
tree0d5bedf4f058048fdde46c34fd9696937f4b7d0a /admin
parent1175096e7886339db8a56b3b6e82c1f04efc5c05 (diff)
Versión 1.0.4, #517: Script de arranque de servicios regenera los permisos adecuados para los directorios de imágenes y de logs.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@2895 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/Sources/Services/opengnsys.init28
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
+