aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/beam/common.in17
-rwxr-xr-xlib/beam/ldap.sh2
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/beam/common.in b/lib/beam/common.in
index bc724c7..e8389f9 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -47,2 +47,3 @@ abend() {
error $@
+ beam_unlock
exit $ec
@@ -52,7 +53,17 @@ beam_lock() {
if [ -r $backup_pidfile ]; then
+ if [ ! -r $PIDFILE ]; then
+ abend 1 "another beam is probably running: $backup_pidfile exists, but is not readable"
+ else
pid=$(head -n 1 $backup_pidfile)
if [ -z "$pid" ]; then
- abend 1 "pidfile $backup_pidfile exists but is unreadable or empty"
+ abend 1 "failed to read PID from $backup_pidfile"
+ else
+ if kill -0 $pid 2>/dev/null; then
+ abend 1 "another beam (pid $pid) is still running; exiting"
+ else
+ error "removing stale pidfile $backup_pidfile"
+ rm $backup_pidfile || abend 1 "failed to remove stale pidfile $backup_pidfile"
+ fi
+ fi
fi
- abend 1 "another beam process (pid $pid) is still running; exiting"
fi
@@ -60,2 +71,3 @@ beam_lock() {
epilogue_hook="$epilogue_hook beam_unlock"
+ trap 'beam_unlock' INT QUIT TERM
}
@@ -155,3 +167,2 @@ runhook() {
local hook_list
-
eval hook_list=\$$1
diff --git a/lib/beam/ldap.sh b/lib/beam/ldap.sh
index 40b9a4b..714b249 100755
--- a/lib/beam/ldap.sh
+++ b/lib/beam/ldap.sh
@@ -82,3 +82,3 @@ ldap_backup() {
elif [ -n "$dbsuf" ]; then
- options="$options -b$slapcat"
+ options="$options -b$dbsuf"
fi

Return to:

Send suggestions and report system problems to the System administrator.