diff options
author | ramon <ramongomez@us.es> | 2017-10-27 11:47:09 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-10-27 11:47:09 +0000 |
commit | 2b9c8d3cb10b14552026c6e38a1e082aaecba434 (patch) | |
tree | d54cb134b5d6a2d2fa83a660de0bbddf47b6bddd /server/bin/ogagentqueue.cron | |
parent | 399af4d8f0dd47c7e424470a2b993eb7409794b6 (diff) |
#708: Script {{{ogagentqueue.cron}}}: corregir erratas en composición de mensajes JSON y en la actualización de la BD.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5488 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'server/bin/ogagentqueue.cron')
-rwxr-xr-x | server/bin/ogagentqueue.cron | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/bin/ogagentqueue.cron b/server/bin/ogagentqueue.cron index b86dac1f..54a9a2b9 100755 --- a/server/bin/ogagentqueue.cron +++ b/server/bin/ogagentqueue.cron @@ -53,11 +53,11 @@ SELECT ogagent_queue.id, ogagent_queue.exectime, ogagent_queue.operation, case "$OPER" in popup-10) # Message: min. before power off. AGNTURL=https://$AGNTIP:8000/opengnsys/popup - DATA='{"title":"Apagado en 10 min.","message","Fin del tiempo de acceso remoto.\nEl ordenador se apagará automáticamente dentro de 10 minutos."}' + DATA='{"title":"Apagado en 10 min.","message":"Fin del tiempo de acceso remoto.\nEl ordenador se apagará automáticamente dentro de 10 minutos."}' ;; popup-5) # Message: 5 min. before power off. AGNTURL=https://$AGNTIP:8000/opengnsys/popup - DATA='{"title":"Apagado en 5 min.","message","El ordenador se apagará automáticamente dentro de 5 minutos.\nATENCIÓN: Este es el último aviso."}' + DATA='{"title":"Apagado en 5 min.","message":"El ordenador se apagará automáticamente dentro de 5 minutos.\nATENCIÓN: Este es el último aviso."}' ;; poweroff) # Power off client. AGNTURL=https://$AGNTIP:8000/opengnsys/poweroff @@ -69,7 +69,7 @@ SELECT ogagent_queue.id, ogagent_queue.exectime, ogagent_queue.operation, esac # Sending operation to OGAgent. if [ -n "$AGNTURL" ]; then - CODE=$(curl -ksm 1 -w "%{http_code}" -o /dev/null -H "'Authorization: $AGNTKEY'" ${DATA:+"-d '$DATA'"} "$AGNTURL") + CODE=$(curl -ksm 1 -w "%{http_code}" -o /dev/null -H "Authorization: $AGNTKEY" ${DATA:+"-d $DATA"} "$AGNTURL") case "$CODE" in 000) # Client does not respond may be halted). ;; @@ -82,13 +82,13 @@ SELECT ogagent_queue.id, ogagent_queue.exectime, ogagent_queue.operation, echo "$(date +"%FT%T%z"): $PROG: Unknown operation: client=$AGNTIP, oper=$OPER" >> $LOGFILE fi # Deleting operation from database. - mysql --defaults-extra-file="$MYCNF" -D "$CATALOG" -Nse " -DELETE FROM ogagent_queue - WHERE id='$OPERID'; + SQL="DELETE FROM ogagent_queue WHERE id='$OPERID';" + [ "$OPER" == "poweroff" ] && SQL="$SQL UPDATE remotepc SET reserved = NOW() - INTERVAL 1 SECOND, urllogin=NULL, urllogout=NULL WHERE id = '$CNLTID'; DELETE FROM acciones WHERE idordenador = '$CLNTID' AND descriaccion = 'RemotePC Session';" + mysql --defaults-extra-file="$MYCNF" -D "$CATALOG" -Nse "$SQL" done |