From 67e59d5868a8749ab25d9ab8f057d81de4794f15 Mon Sep 17 00:00:00 2001 From: Doug Le Tough Date: Tue, 25 Jul 2017 09:09:31 +0200 Subject: [PATCH] "test sys_refresh_ref_cron.sh" --- bin/sys_refresh_ref_cron.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/sys_refresh_ref_cron.sh b/bin/sys_refresh_ref_cron.sh index 8727812..b931ad5 100755 --- a/bin/sys_refresh_ref_cron.sh +++ b/bin/sys_refresh_ref_cron.sh @@ -152,11 +152,6 @@ function get_cronjobs IFS_BAK=${IFS} IFS=$'\n' CRONJOBS=$(ssh ${VM} "sudo crontab -u ${TETALAB_USER} -l 2>&1 | grep -v '^\#' | grep -v '^$' | grep -vP '^ +$'") - #~ RET_VAL=$? - #~ if [ ! ${RET_VAL} -eq 0 ]; then - #~ ERROR="Erreur lors de la récupération de la liste des jobs ${RET_VAL}" - #~ fct_erreur 3 - #~ fi for CRONJOB in ${CRONJOBS} do COLOR="blanc" @@ -167,12 +162,31 @@ function get_cronjobs COLOR="cyan" fi fct_message ${MESSAGE} -color ${COLOR} + refresh_database "${CRONJOB}" done IFS=${IFS_BAK} done done } +function refresh_database +{ + fct_message "Updating database:" + CRONJOB="$@" + MINUTES=$(echo ${CRONJOB} | cut -d' ' -f1) + HOURS=$(echo ${CRONJOB} | cut -d' ' -f2) + DAYS=$(echo ${CRONJOB} | cut -d' ' -f3) + MONTHS=$(echo ${CRONJOB} | cut -d' ' -f4) + YEARS=$(echo ${CRONJOB} | cut -d' ' -f5) + COMMAND=$(echo ${CRONJOB} | cut -d' ' -f5-) + fct_message " * MINUTES: ${MINUTES}" + fct_message " * HOURS: ${HOURS}" + fct_message " * DAYS: ${DAYS}" + fct_message " * MONTHS: ${MONTHS}" + fct_message " * YEARS: ${YEARS}" + fct_message " * COMMAND: ${COMMAND}" +} + #------------------------------------------------------------------------------------------------------------------ # Traitement #------------------------------------------------------------------------------------------------------------------