projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
only need Customer-CDRs, RT#5229
[freeside.git]
/
bin
/
billco-upload
diff --git
a/bin/billco-upload
b/bin/billco-upload
index
ce4a43d
..
3a02ec8
100644
(file)
--- a/
bin/billco-upload
+++ b/
bin/billco-upload
@@
-1,11
+1,26
@@
#!/bin/sh
#!/bin/sh
-AGENTNUMS="1 2 3"
+AGENTNUMS="1 2 3
5 8 9 10
"
date=`date +"%Y%m%d"`
dir="/usr/local/etc/freeside/export.DBI:Pg:dbname=freeside/cust_bill"
date=`date +"%Y%m%d"`
dir="/usr/local/etc/freeside/export.DBI:Pg:dbname=freeside/cust_bill"
+lock=".billco-upload.lock"
cd "$dir"
cd "$dir"
+failed_mutex()
+{
+ echo "billco-upload already running; exiting"
+ exit 1
+}
+
+#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
for AGENTNUM in $AGENTNUMS; do
for a in header detail; do
@@
-14,7
+29,12
@@
for AGENTNUM in $AGENTNUMS; do
zip agentnum$AGENTNUM-$date.zip agentnum$AGENTNUM-$date-header.csv agentnum$AGENTNUM-$date-detail.csv
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
echo $dir/agentnum$AGENTNUM-$date.zip
done
+#release mutex
+rm -f $lock