=== modified file 'sbin/zsvgen' --- sbin/zsvgen 2015-12-07 14:10:29 +0000 +++ sbin/zsvgen 2015-11-03 14:43:01 +0000 @@ -16,9 +16,6 @@ options: -h --help this help -f --filter PATTERN consider only services of given pattern - --lock TIMEOUT perform locking on ZSVDIR - --all-up turn all (filtered) services on - --all-down turn all (filtered) services off END exit 0 fi @@ -32,6 +29,13 @@ set -x fi +if (($#LOCK)); then + exec 3> ${ZSVDIR}.lock + if ! flock -w $LOCK[-1] 3; then + exit 3 + fi +fi + service_patterns=() for pat in $F; do case $pat in @@ -48,18 +52,6 @@ zsv_config zsv_parse -if (($#LOCK)); then - LOCK_TIMEOUT=$LOCK[-1] - if ! [[ $LOCK_TIMEOUT =~ '^[0-9]+$' ]]; then - printf 'Incorrect lock timeout: "%s"' $LOCK_TIMEOUT - exit 2 - fi - exec 3> ${ZSVDIR}.lock - if ! flock -w $LOCK_TIMEOUT 3; then - exit 3 - fi -fi - for d in $ZSVDIR/*(N/); do [[ $d == $ZSVDIR/_* ]] && continue if (($#service_patterns)); then