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