add way to change lock file for flock using second parameter
This commit is contained in:
parent
0402f47302
commit
2a56c7c761
1 changed files with 9 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 () {
|
||||||
|
|
||||||
|
@ -78,4 +85,4 @@ 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