preloader
軟體工程 Crontab execute ruby job without failure

Below execution environment is at Ubuntu 14 LTS. rvm cron setup #sm start rvm example PATH="/usr/local/rvm/gems/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin" GEM_HOME='/usr/local/rvm/gems/ruby-2.3.0' GEM_PATH='/usr/local/rvm/gems/ruby-2.3.0:/usr/local/rvm/gems/ruby-2.3.0@global' MY_RUBY_HOME='/usr/local/rvm/rubies/ruby-2.3.0' IRBRC='/usr/local/rvm/rubies/ruby-2.3.0/.irbrc' RUBY_VERSION='ruby-2.3.0' #sm end rvm example change from shell to bash shell SHELL=/bin/bash # you definie your own crontab job 0 0 * * * . $HOME/.profile; cd /directory/you/want/toexecute; ruby /path/to/yourfile.rb parameter1 parameter2 ...etc > /dev/null 0 1 * * * . $HOME/.profile; cd /directory/you/want/toexecute; ruby /path/to/yourfile.rb `date -d "yesterday" "+%F"`

read more

About

Howard Lee, Frontend-engineer with Angular 7+, Typescript, ReactJS, VueJS. Flutter, Dart, PHP, Ruby, JavaScript, HTML, SASS, CSS, Postgres, MySQL, Web Developer. Have a certificate of AWS Solution Architect Associate with verify number: 8FYNL55LCEEQ10W5. You can verify at AWS Certificate site or Credly site Tech lead role Lead 4 colleagues to build products and infrastructure Coordinate schedule of delivering products Senior web frontend developer role Products Form-filling, form-sharing, file-management, repair-managemnt and project-management for construction industry at Suiqui IoT management and EC platform for Liquid Petroleum Gas(LPG) at Wave-In Comm.

Know More

Tag

Social