From 86e88ad2c230682b154dec201579e41ea3355a54 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 20 Apr 2020 23:30:45 +0200 Subject: [PATCH 1/8] fix log date format %S = seconds %s = number of seconds since epoch --- lib/includes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/includes b/lib/includes index a62e471..b39efc0 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 From ea140f6137a21a68ae790ca87d27aad6a6a283db Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 20 Apr 2020 23:30:57 +0200 Subject: [PATCH 2/8] fix log message wording --- lib/bkctld-start | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 11bb59831c5b417135eced397a9ca25971c1a7c2 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 20 Apr 2020 23:31:39 +0200 Subject: [PATCH 3/8] bkctld-rm: state the age of the process when killing it --- lib/bkctld-rm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bkctld-rm b/lib/bkctld-rm index c5851a7..67e3024 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -19,7 +19,9 @@ kill_or_clean_lockfile() { 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}' has been killed (was running since ${lockfile_date})" else warning "Process not found at PID \`${pid}'. Ignoring lock file \`${lock_file}'." fi From 5f3cc873a1cf3a34b62df2d20d9d3fa54d417fcd Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 20 Apr 2020 23:43:45 +0200 Subject: [PATCH 4/8] fix date format --- lib/includes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/includes b/lib/includes index b39efc0..e00e461 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 From ea912c40f04a9e1abd5cd508b4367f2201f9a3af Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 20 Apr 2020 23:43:56 +0200 Subject: [PATCH 5/8] missing whitespace --- lib/includes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/includes b/lib/includes index e00e461..805df0b 100755 --- a/lib/includes +++ b/lib/includes @@ -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 } From 4829232a6591b1b72676133937954ff050aa6be9 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 21 Apr 2020 09:03:01 +0200 Subject: [PATCH 6/8] quote variable --- lib/bkctld-rm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bkctld-rm b/lib/bkctld-rm index 67e3024..fb61452 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -14,7 +14,7 @@ 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 From fa109e216b54d65e8d8faee64fc3db005c21a846 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 21 Apr 2020 09:03:18 +0200 Subject: [PATCH 7/8] Give the pid of the new process --- lib/bkctld-rm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bkctld-rm b/lib/bkctld-rm index fb61452..67616f4 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -21,7 +21,7 @@ kill_or_clean_lockfile() { kill -9 "${pid}" # 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}' has been killed (was running since ${lockfile_date})" + 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 From 323146d6c3d20d2c27f490ef213b419db5256230 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 22 Apr 2020 01:17:53 +0200 Subject: [PATCH 8/8] Release 2.3.1 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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