Skip to content

Instantly share code, notes, and snippets.

@kazuph
Last active February 2, 2017 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuph/29d43e6aa93feb60bb49 to your computer and use it in GitHub Desktop.
Save kazuph/29d43e6aa93feb60bb49 to your computer and use it in GitHub Desktop.
cronからbundle exec...はsu - <USER> -lc ...が一番便利 ref: http://qiita.com/kazuph/items/c530359eada5b2639e68
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH=$HOME/local/ruby-2.1/bin:$PATH
0 */1 * * * root su - <USER_NAME> -lc "cd /home/<USER_NAME>/yourproject_path && bundle exec ruby hoge.rb" >> /var/log/yourproject/cron/hoge.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment