3
我想通过capistrano使用chmod来为文件夹添加权限。例如,我想这样做:Rails - capistrano和chmod
chmod 777 -R /vol/www/apps/ror_tutorial/current/log/
所以,我想通过capistrano的任务来做到这一点。我试过:
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
但它不起作用。该文件夹的权限是一样的:
$ 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
如果我尝试打印文件模式通过ssh手动它的工作原理:
$ 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
我怎么能写Capistrano的正确的任务做到这一点?
太棒了!谢谢!! – ExiRe 2012-02-04 13:02:46