2004-05-04 17:04:17 +00:00
|
|
|
echo "DOING $text"
|
|
|
|
|
|
|
|
|
|
|
|
# increase counter
|
2009-03-23 15:16:36 +00:00
|
|
|
while ! ln -s x $shared.lock 2> /dev/null; do
|
2004-05-04 17:04:17 +00:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
test -f $shared.cur || echo 0 > $shared.cur
|
|
|
|
test -f $shared.max || echo 0 > $shared.max
|
2014-02-06 12:51:57 +00:00
|
|
|
new=$(($(cat $shared.cur) + 1))
|
2004-05-04 17:04:17 +00:00
|
|
|
if test $new -gt $(cat $shared.max); then
|
|
|
|
echo $new > $shared.max
|
|
|
|
fi
|
|
|
|
echo $new > $shared.cur
|
|
|
|
rm $shared.lock
|
|
|
|
|
|
|
|
|
|
|
|
echo -n $(cat $inputs)$text > $out
|
|
|
|
|
2009-03-23 15:16:36 +00:00
|
|
|
sleep $sleepTime
|
2004-05-04 17:04:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
# decrease counter
|
2009-03-23 15:16:36 +00:00
|
|
|
while ! ln -s x $shared.lock 2> /dev/null; do
|
2004-05-04 17:04:17 +00:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
test -f $shared.cur || echo 0 > $shared.cur
|
2014-02-06 12:51:57 +00:00
|
|
|
echo $(($(cat $shared.cur) - 1)) > $shared.cur
|
2004-05-04 17:04:17 +00:00
|
|
|
rm $shared.lock
|