From 1b3b68ba16bc0fd6d1d003dde07d886a149afbdc Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Wed, 13 Jun 2018 18:21:31 +0200 Subject: [PATCH] Fix last update date of stats index file --- bkctld | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bkctld b/bkctld index de8121b..6e05b42 100755 --- a/bkctld +++ b/bkctld @@ -521,11 +521,14 @@ sub_check() { } sub_stats() { - lsof "${IDX_FILE}" >/dev/null 2>&1 || nohup ionice -c3 "${DUC}" index -d "${IDX_FILE}" "${JAILDIR}" >/dev/null 2>&1 & - timeout 10 sh -c -- "while [ ! -f ${IDX_FILE} ]; do sleep 1; done" + lsof "${IDX_FILE}" >/dev/null 2>&1 || nohup sh -s -- </dev/null 2>&1 & +ionice -c3 "${DUC}" index -d "${IDX_FILE}" "${JAILDIR}" +touch "${INDEX_DIR}/.lastrun.duc" +EOF + [ ! -f "${INDEX_DIR}/.lastrun.duc" ] && notice "First run of DUC always in progress ..." && exit 0 [ ! -f ${IDX_FILE} ] && error "Index file do not exits !" printf "Last update of index file : " - stat --format=%Y "${IDX_FILE}" | xargs -i -n1 date -R -d "@{}" + stat --format=%Y "${INDEX_DIR}/.lastrun.duc" | xargs -i -n1 date -R -d "@{}" echo " " | awk '{ printf("%- 30s %- 10s %- 10s %- 15s\n", $1, $2, $3, $4); }' duc_output=$(mktemp) stat_output=$(mktemp)