Hi all,
I have a very strange problem: In order to find out what parts of a big application being used,
I have added the following line as the first executable line in every .sh file:
/application/sh_log $0
The file sh_log looks like this:
now=$(date +"%Y_%m_%d")
filename=/spool/logs/sh_log_$now.log
if [ -f $filename ]; # Does logfile exist?
then
echo $(basename $1)";"$(date +"%Y%m%d%H%M%S")";" >> $filename # Logfile exists, append log record
else
touch $filename # Logfile did not exist, create it
chmod 7777 $filename # Make it writeable
echo $(basename $1)";"$(date +"%Y%m%d%H%M%S")";" >> $filename # Ans append log record
fi
The application calls it's .sh files in a number of ways, but all of them originating from crontab.
What confuses me is that log entries often appear in tuples, that is, when the application's
.sh file is calling the file making the log entry, supposedly to make a single log entry, I'm still
getting 2, 3 or even more log entries with the same time-stamp (resolution: 1 sec).
I don't understand this and would appreciate if some guru here could give me a clou.
Regards
Lars