diff --git a/CHANGELOG.md b/CHANGELOG.md index 352fb94..fd2d7b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [2.3.1] - 2020-04-22 + +### Added + +* State the age of the current "rm" process when killing it +* Give the new PID after killing the previous "rm" process + +### Fixed + +* typos +* forgotten quotes + ## [2.3.0] - 2020-04-20 ### Changed diff --git a/lib/bkctld-rm b/lib/bkctld-rm index c5851a7..67616f4 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -14,12 +14,14 @@ kill_or_clean_lockfile() { # Get Process ID from the lock file pid=$(cat "${lock_file}") if [ -n "${pid}" ]; then - if kill -0 ${pid} 2> /dev/null; then + if kill -0 "${pid}" 2> /dev/null; then # Kill the children pkill -9 --parent "${pid}" # Kill the parent kill -9 "${pid}" - warning "Process ${pid} has been killed. Only one ${0} can run in parallel, the latest wins." + # Only one bkctld-rm can run in parallel, the latest wins + lockfile_date=$(date --date "@$(stat -c %Y ${lock_file})" +"%Y-%m-%d %H:%M:%S") + warning "Process \`${pid}' (started at ${lockfile_date}) has been killed by \`$$'" else warning "Process not found at PID \`${pid}'. Ignoring lock file \`${lock_file}'." fi diff --git a/lib/bkctld-start b/lib/bkctld-start index e350b96..81c1f92 100755 --- a/lib/bkctld-start +++ b/lib/bkctld-start @@ -37,7 +37,7 @@ for try in $(seq 1 10); do done if [ -n "${pid}" ]; then - notice "Start jail \`${jail_name}' : PID \`${pid}'" + notice "Start jail \`${jail_name}' : OK [${pid}]" else error "Failed to fetch SSH PID for jail \`${jail_name}' within 3 seconds" fi diff --git a/lib/includes b/lib/includes index a62e471..805df0b 100755 --- a/lib/includes +++ b/lib/includes @@ -24,7 +24,7 @@ WARNING="${WARNING:-24}" DUC=$(command -v duc-nox || command -v duc) log_date() { - echo "[$(date +%Y-%m-%d %H:%M:%s)]" + echo "[$(date +"%Y-%m-%d %H:%M:%S")]" } process_name() { basename $0 @@ -40,7 +40,7 @@ debug() { info() { msg="${1:-$(cat /dev/stdin)}" if [ "${LOGLEVEL}" -ge 6 ]; then - tty -s && echo "$(log_date) INFO $(process_name)${msg}" + tty -s && echo "$(log_date) INFO $(process_name) ${msg}" logger -t bkctld -p daemon.info "$(process_name) ${msg}" fi }