add way to change lock file for flock using second parameter
This commit is contained in:
parent
cb7d9a4525
commit
305b08b544
1 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [ -z "$2" ]
|
||||||
|
then
|
||||||
|
lock_variable="/var/lock/zfs-backup-mm"
|
||||||
|
else
|
||||||
|
lock_variable="$2"
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
flock -n 200 || { echo 'locked via flock on file /var/lock/zfs-backup-mm' ; exit 1; }
|
flock -n 200 || { echo "locked via flock on file $lock_variable" ; exit 1; }
|
||||||
|
|
||||||
zfsnap_block () {
|
zfsnap_block () {
|
||||||
|
|
||||||
|
@ -83,4 +90,5 @@ if [[ $# -eq 0 ]] ; then
|
||||||
fi
|
fi
|
||||||
source $1
|
source $1
|
||||||
zfsnap_block
|
zfsnap_block
|
||||||
) 200>/var/lock/zfs-backup-mm
|
) 200>$lock_variable
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue