Find how big a work directory can get during execution- linux

Solution for Find how big a work directory can get during execution- linux
is Given Below:

I have a cron job and this cron job is doing something with lots of data and then delete all the temp files it creates. during the execution, I get ‘ERROR: Insufficient space in file WORK.AIB_CUSTOMER_DATA.DATA.’ the current work directory has 50G free, when I run the code in another directory with 170G free space, I don’t get the error, I want to track the size of working directory during the execution.

I’m afraid I might not fully understand your problem.
In order to get an understanding on how fast is it growing in terms of size you could run a simple script like:

#!/bin/bash

while true
do

#uncomment this to check all partitions of the system.
#df -h >> log.log
#uncomment this to check the files in the current folder.
#du -sh * >> log.log
sleep 1

done

Then analyze the logs and see the increase in size.

I wrote this script and let it run during the job execution to monitor the directory size and get the maximum amount of size for this work directory.

#!/bin/bash 
Max=0
while true  
do
SIZE=`du -sh -B1 /data/work/EXAMPLE_work* | awk '{print $1}' `
echo size: $SIZE
echo max: $Max
if [ "$SIZE" -ge $Max ]
  then
   echo "big size: $SIZE" > /home/mmm/Biggestsize.txt
   Max=$SIZE
 else
   echo "small size: $SIZE" > /home/mmm/sizeSmall.txt
fi
done