Skip to content

Commit

Permalink
estimate the exact time when the disk will be full
Browse files Browse the repository at this point in the history
  • Loading branch information
norc committed Apr 20, 2011
1 parent d79a85f commit 7c95b0f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions watch-download-progress
Expand Up @@ -36,14 +36,19 @@ do
time=$(date +%s)
echo -n "Have $(( $size / 1024 ))M"
echo -n " in $(find . -name '*flv' | wc -l) files,"
echo -n " growing at $(( $(( $size - $previous_size )) / $(( $time - $previous_time )) )) k/s."
free_space=$(df -Pk . | df_filter | tail -n1)
echo -n " ${free_space}k of disk space left."
kbps=$(( $(( $size - $previous_size )) / $(( $time - $previous_time )) ))
echo -n " growing at ${kbps}k/s."
free_space_kb=$(df -Pk . | df_filter | tail -n1)
echo -n " $(( ${free_space_kb} / 1024 ))M of free space"
if [ $kbps -gt 0 ]; then
echo -n ", will last until $(date -d @$(( $(date +%s) + $free_space_kb / $kbps )))"
fi
echo -n .
if [ -f STOP ]; then
echo " STOP file exists."
else
echo
if [ $free_space -lt $free_space_threshold_kb ]; then
if [ $free_space_kb -lt $free_space_threshold_kb ]; then
echo "Running out of disk space! Creating STOP file to warn listerine."
touch STOP
fi
Expand Down

0 comments on commit 7c95b0f

Please sign in to comment.