For example when running grml-live inside a docker
environment, /proc doesn't necessarily exist.
Instead use seconds since the epoch as base for calculating runtime.
Development time sponsored by Sipwise GmbH
-start_seconds=$(cut -d . -f 1 /proc/uptime)
+SECONDS=unknown
+start_seconds="$(date +%s)"
log "------------------------------------------------------------------------------"
log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
log "Using local config file: $LOCAL_CONFIG"
log "------------------------------------------------------------------------------"
log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
log "Using local config file: $LOCAL_CONFIG"
-[ -n "$start_seconds" ] && SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" || SECONDS="unknown"
+if [ -n "${start_seconds}" ] ; then
+ end_seconds="$(date +%s)"
+ SECONDS="$(( end_seconds - start_seconds ))"
+fi
log "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]"
dpkg_to_db # make sure we catch the last log line as well, therefore execute between log + einfo
log "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]"
dpkg_to_db # make sure we catch the last log line as well, therefore execute between log + einfo