Module: Buzztools::Shell

Defined in:
lib/buzztools/shell.rb

Class Method Summary collapse

Class Method Details

.run(aCommand) ⇒ Object

from whenever crontab /bin/bash -l -c ‘cd /var/www/homeopen.com/releases/20140714092436 && bin/rails runner -e production ’'‘scripts/update_contacts.rb’'‘ >> log/cron.log 2>&1’



8
9
10
# File 'lib/buzztools/shell.rb', line 8

def run(aCommand)
  `/bin/bash -l -c 'cd "#{Rails.root.to_s}" && #{aCommand} 2>&1'`        # bin/rails runner -e production '\''scripts/update_contacts.rb'\'' >> log/cron.log 2>&1'`
end

.runner(aScript, *args) ⇒ Object



12
13
14
15
16
17
# File 'lib/buzztools/shell.rb', line 12

def runner(aScript,*args)
  pars = (args || []).join(' ')
  cmd = "rails runner -e #{Rails.env} #{aScript}"
  cmd += ' ' + pars if pars
  run(cmd)
end