summaryrefslogtreecommitdiffstats
path: root/admin/Interface/EjecutarScript
blob: 431164b91847fa68ac9243b9cc899c5ef51d3e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
TIME1=$SECONDS

OGLOGSESSION="${OGLOGSESSION=:-/tmp/session.log}"
OGLOGCOMMAND="${OGLOGCOMMAND=:-/tmp/command.log}"

OGLOGSESSION="/tmp/session.log"
OGLOGCOMMAND="/tmp/command.log"

echo " " > $OGLOGSESSION
echo " " > $OGLOGCOMMAND
echo " " > ${OGLOGCOMMAND}.tmp


echo "START JOBS ***************************** " |  tee -a $OGLOGSESSION $OGLOGFILE

echo "Instrucciones a ejecutar: *****************************" >>  $OGLOGFILE
cat  $1 >> $OGLOGFILE

echo "Salida de las instrucciones: *****************************" >>  $OGLOGFILE
chmod +x $1
$1 &>> $OGLOGCOMMAND
RETVAL=$?
echo $RETVAL &>> $OGLOGFILE
TIME=$[SECONDS-TIME1]
if [ $RETVAL == 0 ]
then
	echo "[100] Duracion de la operacion $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE
else
	echo "ERROR no operacion no realizada" | tee -a $OGLOGSESSION $OGLOGFILE
fi
echo "END JOBS ***************************** " |  tee -a $OGLOGSESSION $OGLOGFILE
exit $RETVAL