Created
November 20, 2015 22:28
-
-
Save michaeldyrynda/31e98d51180c99e44091 to your computer and use it in GitHub Desktop.
Clean old releases in Envoy
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
@task('clean_old_releases') | |
# This lists our releases by modification time and delete all but the 3 most recent. | |
purging=$(ls -dt {{ $release_dir }}/* | tail -n +3); | |
if [ "$purging" != "" ]; then | |
echo Purging old releases: $purging; | |
rm -rf $purging; | |
else | |
echo "No releases found for purging at this time"; | |
fi | |
@endtask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To anyone else using this piece of code, ensure that your
$release_dir
is properly set or you'll end up wiping out everything on your server like I did : )