Rails - capistrano and chmod

I want to use chmod via capistrano to add permissions for a folder. For example, I want to do this:

chmod 777 -R /vol/www/apps/ror_tutorial/current/log/ 

So, I want to do this using the capistrano task. I tried this:

 desc "Fix permission" task :fix_permissions, :roles => [ :app, :db, :web ] do run "#{try_sudo} chmod 777 -R #{current_path}/log" end after "deploy:update_code", :fix_permissions 

But that will not work. Folder permissions are the same:

 $ ls -alh /vol/www/apps/ror_tutorial/current/log/ total 1008K drwxrwxrwx 2 root root 4.0K 2012-02-03 20:22 . drwxrwxr-x 7 root root 4.0K 2012-01-25 20:50 .. -rwxrwxrwx 1 root root 419K 2012-02-03 14:35 development.log -rwxrwxrwx 1 root root 530K 2012-02-03 20:16 production.log -rwxrwxrwx 1 root root 0 2012-02-02 14:21 searchd.development.pid -rwxrwxrwx 1 root root 15K 2012-02-03 20:22 searchd.log -rw------- 1 root root 6 2012-02-03 20:22 searchd.production.pid -rwxrwxrwx 1 root root 19K 2012-02-03 18:07 searchd.query.log 

If I try to print chmod manually via ssh, it works:

 $ chmod 777 -R /vol/www/apps/ror_tutorial/current/log/ $ ls -alh /vol/www/apps/ror_tutorial/current/log/ total 1008K drwxrwxrwx 2 root root 4.0K 2012-02-03 20:22 . drwxrwxr-x 7 root root 4.0K 2012-01-25 20:50 .. -rwxrwxrwx 1 root root 419K 2012-02-03 14:35 development.log -rwxrwxrwx 1 root root 530K 2012-02-03 20:16 production.log -rwxrwxrwx 1 root root 0 2012-02-02 14:21 searchd.development.pid -rwxrwxrwx 1 root root 15K 2012-02-03 20:22 searchd.log -rwxrwxrwx 1 root root 6 2012-02-03 20:22 searchd.production.pid -rwxrwxrwx 1 root root 19K 2012-02-03 18:07 searchd.query.log 

How can I write the correct task for capistrano for this?

+3
source share
1 answer

Try changing the binding after deployment: symlink, I think you are updating permissions in the "previous" current directory. On the side note: deploy: symlink will change soon for deployment: create_symlink, remember this if it happens after you upgrade capistrano to 2.10 or higher.

+6
source

All Articles