]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/web/templates/default/rails.cron.erb
Only cleanup rails temporary directory if it exists
[chef.git] / cookbooks / web / templates / default / rails.cron.erb
index e34880f36ec537d5a243dd7e792aa09da711347f..4fe3bf99a324772430690f7bfcbae3defb47bf68 100644 (file)
@@ -1,7 +1,13 @@
 #!/bin/sh
 
 # Cleanup temporary directory
-find <%= @directory %>/tmp \( \( -type f -mtime +28 \) -o \( -type d -empty \) \) -delete
+if [ -d <%= @directory %>/tmp ]
+then
+    find <%= @directory %>/tmp \( \( -type f -mtime +28 \) -o \( -type d -empty \) \) -delete
+fi
 
 # Cleanup assets
-/usr/local/bin/cleanup-rails-assets <%= @directory %>
+if [ -x /usr/local/bin/cleanup-rails-assets ]
+then
+    /usr/local/bin/cleanup-rails-assets <%= @directory %>
+fi