whenever --help
Usage: whenever [options]
-i [identifier], Default: full path to schedule.rb file
--update-crontab
-w, --write-crontab [identifier] Default: full path to schedule.rb file
-c, --clear-crontab [identifier]
-s, --set [variables] Example: --set 'environment=staging&path=/my/sweet/path'
-f, --load-file [schedule file] Default: config/schedule.rb
-u, --user [user] Default: current user
-k, --cut [lines] Cut lines from the top of the cronfile
-r, --roles [role1,role2] Comma-separated list of server roles to generate cron jobs for
-v, --version
仔细看-s命令
cd /home&&bundle install&&RAILS_ENV=staging bundle exec rake db:migrate&&bundle exec whenever --update-crontab -s environment=staging&&RAILS_ENV=staging bundle exec rake assets:precompile&&puma -e staging
重要代码
bundle exec whenever --update-crontab -s environment=staging