I’m having a problem with running dupReport.py multiple times in one session. For instance, I have a bash script set up that does the following:
/dupReport/dupReport.py -r /dupReport/rc/location1
/dupReport/dupReport.py -r /dupReport/rc/location2
/dupReport/dupReport.py -r /dupReport/rc/location3
/dupReport/dupReport.py -r /dupReport/rc/location4
/dupReport/dupReport.py -r /dupReport/rc/location5
… and a crontab file that looks like this:
0 07 * * 1-5 /dupReport/dupReport.py -r /dupReport/rc/location1
0 13 * * 1-5 /dupReport/dupReport.py -r /dupReport/rc/location2
0 13 * * 1-5 /dupReport/dupReport.py -r /dupReport/rc/location3
0 13 * * 1-5 /dupReport/dupReport.py -r /dupReport/rc/location4
0 13 * * 1-5 /dupReport/dupReport.py -r /dupReport/rc/location5
The script (above) is used for me to test what backup reports look like before they are put into production and end-users get the reports.
The crontab (below) is how I’d like to run them once they are in production.
Thankfully, I’m the only one getting the emails right now. Otherwise, I’d have a really big problem.
The output of both scenarios above generates 5 emails.
The first email looks perfect.
The second email contains the data for the first location and then the data for the second.
The third email contains the data for the first through third locations.
The fourth email contains the data for the first through fourth locations
The fifth email contains the data for the first through fifth locations
(… and a partridge in a pear treeeee)
So, it’s obvious that the do-while or for-x-to-y statement is running an append on a variable in the script that contains the output. The problem is, at the end of each script, the variables don’t appear to be getting cleared.
Is this an easy fix?