papertank / envoy-deploy

Laravel Envoy Deployment
MIT License
424 stars 85 forks source link

Cleanup doesn't work #1

Closed tudor2004 closed 9 years ago

tudor2004 commented 9 years ago

The ls -1d 20* | head -n -5 | xargs -d \'\n\' sudo rm -Rf; doesn't work. It seems there is an issue with the '\n'. If i output the command I get the following: ls -1d 20* | head --lines=-1 | xargs -d n sudo rm -Rf

davidrushton commented 9 years ago

@tudor2004 Thanks for pointing this out.

I've been running some tests with other commands and I believe the following will work best as a replacement:

find . -maxdepth 1 -name "20*" -mmin +2880 | head -n 5 | xargs rm -Rf;

This should delete any deployments older than 48 hours, limiting to the first 5 it finds to keep some backups for rolling back to.

In hindsight, ls -1d 20* | head -n 5 | xargs -d sudo rm -Rf; would delete the first 5 deployments (including the one you just did) if used.

davidrushton commented 9 years ago

Updated in dab29a4dd27f77be279302b04f4fe7d53b8036e2