diff options
Diffstat (limited to 'src/pro-archman.sh')
-rw-r--r-- | src/pro-archman.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pro-archman.sh b/src/pro-archman.sh index 1f9628b..8b0719b 100644 --- a/src/pro-archman.sh +++ b/src/pro-archman.sh @@ -36,6 +36,7 @@ conf_incoming_channel= conf_incoming_dir= conf_pool_gc_delay= archive= +lock= # use() must be defined inline so it can be used to load other modules. use() @@ -100,6 +101,14 @@ main() # FIXME: Remove. archive="${opt_base_dir}" + mkdir -p "${opt_base_dir}/.db" + lock="${opt_base_dir}/.db/lock" + if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then + printf '%s: Error: ' "${0##*/}" >&2 + printf "$(get_msg 'lock_fail')\n" >&2 + exit 2 + fi + if [ "x${opt_cmd}" != 'x' ]; then run_cmd "${opt_cmd}" "${@}" status=${?} @@ -159,5 +168,8 @@ fini() { update_feeds collect_garbage + + rm -f "${lock}" } + main "${@}" |