Add restore script, use it to move the latest lock file to the destinations
This commit is contained in:
parent
0a91afa541
commit
9cb44a8932
3 changed files with 60 additions and 7 deletions
18
util_lib.sh
18
util_lib.sh
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
LOCK_ROOT=".lock"
|
||||
|
||||
# Enable the NULL_GLOB option to handle cases where no subdirectories exist
|
||||
setopt NULL_GLOB
|
||||
|
||||
# Define a function to create key-value pairs
|
||||
create_mapping() {
|
||||
local input="$1"
|
||||
|
|
@ -31,3 +34,18 @@ function get_latest_lock() {
|
|||
|
||||
echo $latest_lock
|
||||
}
|
||||
|
||||
function has_lock() {
|
||||
local latest_lock=$1
|
||||
|
||||
# if first parameter does not exist, call get_latest_lock
|
||||
if [[ -z $latest_lock ]]; then
|
||||
latest_lock=$(get_latest_lock)
|
||||
fi
|
||||
|
||||
if [[ $latest_lock -ne 0 ]]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue