-#acquire mutex
-[ -f $lock ] && {
- failed_mutex
-} || {
- echo $$ > $lock
- [ $(cat $lock 2>/dev/null) -eq $$ ] || failed_mutex
-}
-
-for AGENTNUM in $AGENTNUMS; do
-
- for a in header detail; do
- mv agentnum$AGENTNUM-$a.csv agentnum$AGENTNUM-$date-$a.csv
- done
-
- zip agentnum$AGENTNUM-$date.zip agentnum$AGENTNUM-$date-header.csv agentnum$AGENTNUM-$date-detail.csv
-
-# Remove if trying to find problems with billco upload files
- rm *$AGENTNUM-$date*.csv
-
- echo $dir/agentnum$AGENTNUM-$date.zip
-
-done
-
-#release mutex
-rm -f $lock