"test sys_refresh_ref_cron.sh"

This commit is contained in:
Doug Le Tough 2017-07-25 09:09:31 +02:00
parent f834c8b9f7
commit 67e59d5868

View File

@ -152,11 +152,6 @@ function get_cronjobs
IFS_BAK=${IFS} IFS_BAK=${IFS}
IFS=$'\n' IFS=$'\n'
CRONJOBS=$(ssh ${VM} "sudo crontab -u ${TETALAB_USER} -l 2>&1 | grep -v '^\#' | grep -v '^$' | grep -vP '^ +$'") 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} for CRONJOB in ${CRONJOBS}
do do
COLOR="blanc" COLOR="blanc"
@ -167,12 +162,31 @@ function get_cronjobs
COLOR="cyan" COLOR="cyan"
fi fi
fct_message ${MESSAGE} -color ${COLOR} fct_message ${MESSAGE} -color ${COLOR}
refresh_database "${CRONJOB}"
done done
IFS=${IFS_BAK} IFS=${IFS_BAK}
done done
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 # Traitement
#------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------