repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
make getpeername() return the original socket address which before it was intercepted
[hband-tools.git]
/
user-tools
/
singleinstance
blob
03bf9d7f3483297715e9b27ad10204a9bcd0c42b
1
#!/bin/sh
2
3
if
[
$#
-lt
2
]
4
then
5
echo
"Usage: singleinstance <LOCKFILE> <COMMAND> [<ARGS>]"
>&
2
6
exit
1
7
fi
8
9
set -e
10
11
lockpidfile
=
$1
12
shift
13
14
exec
flock
--exclusive --nonblock --no-fork
"
$lockpidfile
"
withpidfile
"
$lockpidfile
"
"$@"