Created
June 5, 2015 16:44
-
-
Save prasincs/903183bc2b53e7955fb6 to your computer and use it in GitHub Desktop.
Purge Spark Files created by Mesos/Spark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set +x | |
set -o pipefail | |
spark_tmp_dirs=$(sudo ls -d /tmp/spark-*) | |
for dir in $spark_tmp_dirs; do | |
num_procs_using_dir=$(sudo lsof +D $dir | wc -l) | |
if [ "$num_procs_using_dir" = "0" ]; then | |
sizeof_dir=$(sudo du -sh . | cut -d$'\t' -f 1) | |
echo "Deleting $dir -- should free up $sizeof_dir" | |
sudo rm -r $dir | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment