Created
July 16, 2014 10:15
-
-
Save kazuph/c78facaec095759aaf8e to your computer and use it in GitHub Desktop.
cronをシンボリックリンクにしている場合にcapistranoで権限変更をしたい ref: http://qiita.com/kazuph/items/982257cef2424634f459
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+set :pty, true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s /home/your_username/your_project_name/current/misc/cron/sample /etc/cron.d/sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_DIR=/home/your_username/your_project_name/current | |
LOG_DIR=/var/log/your_project_name/cron | |
# 毎週火曜10:00に実行 | |
00 10 * * 2 root su your_username -l -c "cd ${APP_DIR} && bundle exec rake sample:run RAILS_ENV=production" >> ${LOG_DIR}/sample.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :symlink_cron do | |
desc "change owner to root" | |
task :change_permission do | |
on roles(:app) do | |
execute :sudo, "chmod 644 #{release_path}/misc/cron/sample" | |
execute :sudo, "chown root:root #{release_path}/misc/cron/sample" | |
end | |
end | |
after 'deploy:published', 'symlink_cron:change_permission' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment