summaryrefslogtreecommitdiffstats
path: root/admin/Sources/Services
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2012-03-28 13:05:08 +0000
committerramon <ramongomez@us.es>2012-03-28 13:05:08 +0000
commit1cf578b9800166314a72f8c12bcce4614e60cbb7 (patch)
tree421d9beb0a2cc009adf804ad9605393d19c0649c /admin/Sources/Services
parentb86ca815702946d8bc6b353415ebeee32e5e0e80 (diff)
VersiĆ³n 1.0.4, #414: Script de arranque/parada de servicios compatible para varias distribuciones.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@2930 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/Sources/Services')
-rwxr-xr-xadmin/Sources/Services/opengnsys.init49
1 files changed, 25 insertions, 24 deletions
diff --git a/admin/Sources/Services/opengnsys.init b/admin/Sources/Services/opengnsys.init
index 5a31aa78..a4617b29 100755
--- a/admin/Sources/Services/opengnsys.init
+++ b/admin/Sources/Services/opengnsys.init
@@ -61,8 +61,7 @@ BTTRACKDFILE=/tmp/dstate
BTTRACKLOG=$BASEDIR/log/bttrack.log
BTINTERVAL=30
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"
+BTTRACK_OPTIONS=" --port $BTTRACKPORT --dfile $BTTRACKDFILE --reannounce_interval $BTINTERVAL --logfile $BTTRACKLOG --allowed_dir $BTTORRENTSDIR --allow_get 1"
BTTRACKPID="/var/run/bttrack.pid"
BTSEEDERPID="/var/run/btseeder.pid"
@@ -70,8 +69,7 @@ BTSEEDERPID="/var/run/btseeder.pid"
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin:/usr/bin"
# Read config file if it is present.
-if [ -r /etc/default/opengnsys ]
-then
+if [ -r /etc/default/opengnsys ]; then
source /etc/default/opengnsys
fi
@@ -87,6 +85,11 @@ config() {
ACTIONMSG="log_daemon_msg"
SUCCESSMSG="log_end_msg 0"
FAILMSG="log_end_msg 1"
+ TRACKERSTART="start-stop-daemon --make-pidfile --pidfile $BTTRACKPID --start --quiet --background --exec"
+ BTTRACK_OPTIONS="$BTTRACK_OPTIONS --parse_allowed_interval 1"
+ TRACKERSTOP="start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $BTTRACKERPID"
+ SEEDERSTART="start-stop-daemon --make-pidfile --pidfile $BTSEEDERPID --start --quiet --background --exec"
+ SEEDERSTOP="start-stop-daemon --stop --quiet --oknodo --pidfile $BTSEEDERPID"
;;
CentOS|Fedora)
INITFUNCTIONS=/etc/init.d/functions
@@ -96,6 +99,12 @@ config() {
ACTIONMSG="echo -n"
SUCCESSMSG="eval ( success; echo )"
FAILMSG="eval ( failure; echo )"
+ BTTRACK=/usr/bin/bttrack.py
+ BTSEEDER=/usr/bin/btlaunchmany.py
+ TRACKERSTART="daemon --pidfile $BTTRACKPID"
+ TRACKERSTOP="killproc -p $BTTRACKPID $BTTRACK"
+ SEEDERSTART="daemon --pidfile $BTSEEDERPID"
+ SEEDERSTOP="killproc -p $BTSEEDERPID $BTSEEDER"
;;
*) echo "DistribuciĆ³n Linux desconcocida o no soportada."
exit ;;
@@ -126,18 +135,15 @@ arranca_demonios() {
chgrp $OPENGNSYSUSER $CLIENTLOGDIR
fi
# Arrancar los servicios indicados.
- if [ $RUN_OGADMSERVER = "yes" ]
- then
+ if [ $RUN_OGADMSERVER = "yes" ]; then
$ACTIONMSG "Iniciando demonio: $SERVERNAME"
$DAEMONSTART $SERVERDAEMON $EXTRAOPTS $SERVERDAEMON_OPTIONS $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
fi
- if [ $RUN_OGADMSERVER = "yes" ] && [ $RUN_OGADMREPO = "yes" ]
- then
+ if [ $RUN_OGADMSERVER = "yes" ] && [ $RUN_OGADMREPO = "yes" ]; then
sleep 5 # Damos tiempo a que ogAdmServer este funcionando
fi
- if [ $RUN_OGADMREPO = "yes" ]
- then
+ if [ $RUN_OGADMREPO = "yes" ]; then
$ACTIONMSG "Iniciando demonio: $REPONAME"
$DAEMONSTART $REPODAEMON $EXTRAOPTS $REPODAEMON_OPTIONS $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
@@ -147,39 +153,34 @@ arranca_demonios() {
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
############ ADV
fi
- if [ $RUN_OGADMAGENT = "yes" ]
- then
+ if [ $RUN_OGADMAGENT = "yes" ]; then
$ACTIONMSG "Iniciando demonio: $AGENTNAME"
$DAEMONSTART $AGENTDAEMON $EXTRAOPTS $AGENTDAEMON_OPTIONS $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
fi
- if [ $RUN_BTTRACKER = "yes" ]
- then
+ if [ $RUN_BTTRACKER = "yes" ]; then
$ACTIONMSG "Iniciando demonio: $BTTRACK"
- start-stop-daemon --make-pidfile --pidfile $BTTRACKPID --start --quiet --background --exec $BTTRACK -- $BTTRACK_OPTIONS
+ $TRACKERSTART $BTTRACK $EXTRAOPTS $BTTRACK_OPTIONS $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
fi
- if [ $RUN_BTSEEDER = "yes" ]
- then
+ if [ $RUN_BTSEEDER = "yes" ]; then
$ACTIONMSG "Iniciando demonio: $BTSEEDER"
- start-stop-daemon --make-pidfile --pidfile $BTSEEDERPID --start --quiet --background --exec $BTSEEDER -- $BTTORRENTSDIR
+ $SEEDERSTART $BTSEEDER $EXTRAOPTS $BTTORRENTSDIR &>/dev/null $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
fi
}
para_demonios() {
- if [ -e $BTSEEDERPID ]
- then
+ if [ -e $BTSEEDERPID ]; then
$ACTIONMSG "Parando demonio: $BTSEEDER"
- start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $BTSEEDERPID
+ $SEEDERSTOP
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
rm -f $BTSEEDERPID
fi
- if [ -e $BTTRACKPID ]
- then
+ if [ -e $BTTRACKPID ]; then
$ACTIONMSG "Parando demonio: $BTTRACK"
- start-stop-daemon --stop --quiet --oknodo --pidfile $BTTRACKPID
+ $TRACKERSTOP
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
rm -f $BTTRACKPID
fi