Improve rails tmp dir cleanup script
authorTom Hughes <tom@compton.nu>
Tue, 22 Sep 2015 11:56:29 +0000 (12:56 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 22 Sep 2015 11:56:29 +0000 (12:56 +0100)
cookbooks/web/templates/default/rails.cron.erb

index 7945c3d..35256a2 100644 (file)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 # Cleanup temporary directory
-find <%= @directory %>/tmp -mtime +28 -print0 | xargs -0r rm
+find <%= @directory %>/tmp \( \( -type f -mtime +28 \) -o \( -type d -empty \) \) -delete