NAME
parentlock - share parent's lock with child processes.
SYNOPSIS
parentlock [-v] [--lock | --unlock] [--status] [--lockfile] lockfile [-p|--pid] PID
DESCRIPTION
parentlock is useful for shell scripting where there are lots of nested script calls and we want to share a lock from the main wrapper script for its subprocesses through the parent - child relationship.
Note that unlocking is optional because the lock becomes invalid when the process that lock contains its pid dies.
EXAMPLES
In each chell script add at the beginning
#!/bin/sh
LOCKFILE=/workdir/.lock
parentlock --lock --lockfile $LOCKFILE $$ || exit 1
...
OPTIONS
- -l,--lock
-
Lock
- -u,--unlock
-
Unlock
- -p,--pid
-
PID to lock with.
- -f,--file,--lockfile path
-
Lockfile name to be created. A relative path will be converted to the absolute path at the moment script called.
- -v,--verbose
-
Increase verbosity level.
- -q,--quiet
-
Silent mode.
AUTHOR
Written by Igor Vlasenko <viy@altlinux.org>.
ACKNOWLEGEMENTS
To Alexey Torbin <at@altlinux.org>, whose qa-robot package had a strong influence on repocop.
COPYING
Copyright (c) 2008 Igor Vlasenko, ALT Linux Team.
This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.