Tip of the day: Linux script to see which reports are run during the day
GCC Consulting
rkreiss at gccconsulting.net
Fri Feb 3 07:00:17 PST 2012
-----Original Message-----
From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
[mailto:filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com] On
Behalf Of Mike Schwartz
Sent: Friday, February 03, 2012 8:45 AM
To: filePro Mailing List
Subject: Tip of the day: Linux script to see which reports are run during
the day
Since the fP list has been a little slow, I thought I would pass along
this script I whipped up last night.
A friend who does most of his own filePro programming is changing his
printer setup. He asked me if there was some way in filePro to capture the
name of each report that is run during a typical day. I whipped up this
quick Linux script and he was happy with it, but I thought I would throw
this out to the group to see if any of you would have done things
differently:
----- ----- -----------------------------------
>/tmp/zrptlist.txt
for i in {1..10000} # loop 10000 (5-second) intervals
13.8 hours
do
ps -ef | grep -y report | grep -v 'grep\|pv\|\/u\/reports' | grep -y
"\-f" >>/tmp/zrptlist.txt
echo $i # Display loop count
tail /tmp/zrptlist.txt # Display last few reports that were run
sleep 5
done
----- ----- ----------------------------------
The script only runs every 5 seconds, so there's a slight possibility
it will miss some quick-running reports.
It has a loop rather than a cron job so that the user has more control
over when it runs. He will probably only run it occasionally.
It skips reports that go to the video screen. It skips the "grep"
line that is calling it. It skips any of the overnight batch reports that
print to files in the /u/reports subdirectory.
Enjoy!
Mike Schwartz
Another approach is to log each report as it is run from within filepro.
The system maintained field @fn has the report format name.
@once::La="Date"<@td<",Time:"<@tm<"File"<@fi<"Report"<@fn<"Who:"<@id{"";END
Logtext la
This would track who, what and when.
This could instead be written to a filepro file to allow more analysis of
the reports be run and by whom. You could also add at @done the same
logging which would tell you how long it took to run the report.
This would not need to be run as a cron job and would not miss any of the
reports being run.
This could be setup as a call routine making it easy to add to the existing
programming. This may take a bit longer to implement but will give a lot
more information.
This approach will work for both *nix and windows. @id is available for
those of us running windows with fp version 5.0.12 or later with a limit of
8 characters.
Richard Kreiss
GCC Consulting
Office: 410-653-2813
More information about the Filepro-list
mailing list