找出工作目录在执行期间可以达到多大 - linux

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

我有一个 cron 作业,这个 cron 作业正在处理大量数据,然后删除它创建的所有临时文件。在执行过程中,我得到 'ERROR: Insufficient space in file WORK.AIB_CUSTOMER_DATA.DATA.' 当前工作目录有 50G 空闲,当我 运行 另一个目录中有 170G 空闲 space 的代码时,我没有得到错误,我想要在执行期间跟踪工作目录的大小。

恐怕我可能无法完全理解您的问题。 为了了解它在大小方面的增长速度,您可以 运行 一个简单的脚本,例如:

#!/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

然后分析日志,查看大小的增加。

我编写了这个脚本,并在作业执行期间让它 运行 监视目录大小并获取此工作目录的最大大小。

#!/bin/bash 
Max=0
while true  
do
SIZE=`du -sh -B1 /data/work/EXAMPLE_work* | awk '{print }' `
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