2004-05-04 20:04:17 +03:00
|
|
|
echo "DOING $text"
|
|
|
|
|
|
|
|
|
|
|
|
# increase counter
|
2009-03-23 17:16:36 +02:00
|
|
|
while ! ln -s x $shared.lock 2> /dev/null; do
|
2004-05-04 20:04:17 +03:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
test -f $shared.cur || echo 0 > $shared.cur
|
|
|
|
test -f $shared.max || echo 0 > $shared.max
|
2014-02-06 14:51:57 +02:00
|
|
|
new=$(($(cat $shared.cur) + 1))
|
2004-05-04 20:04:17 +03: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 17:16:36 +02:00
|
|
|
sleep $sleepTime
|
2004-05-04 20:04:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
# decrease counter
|
2009-03-23 17:16:36 +02:00
|
|
|
while ! ln -s x $shared.lock 2> /dev/null; do
|
2004-05-04 20:04:17 +03:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
test -f $shared.cur || echo 0 > $shared.cur
|
2014-02-06 14:51:57 +02:00
|
|
|
echo $(($(cat $shared.cur) - 1)) > $shared.cur
|
2004-05-04 20:04:17 +03:00
|
|
|
rm $shared.lock
|