Merge branch 'master' into debian

This commit is contained in:
Jérémy Lecour 2020-04-22 01:18:11 +02:00 committed by Jérémy Lecour
commit 11a8b7e32d
4 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
}