0

I have this cronfile :

# Begin Whenever generated tasks for: mtaville_staging

* * * * * cd /home/mtaville/mtaville_staging/releases/20141202140931 && RAILS_ENV=staging bundle exec rake cinemas:import --silent

# End Whenever generated tasks for: mtaville_staging

but it doesn't run the task.

When I had this :

* * * * * cd /home/mtaville/ && touch "echo.txt"

The file "echot.txt" is created... But not my task !

EDIT

nohup: les entrées sont ignorées
nohup: impossible d'exécuter la commande «cinemas:import»: Aucun fichier ou dossier de ce type

EDIT FINAL

Here is my crontask :

* * * * * /bin/bash -c 'export PATH="$HOME/.rbenv/bin:$PATH" ; eval "$(rbenv init -)"; cd /home/mtaville/mtaville_staging/current ; RAILS_ENV=staging bundle exec rake cinemas:import > /tmp/log.txt 2>&1'
p0k3
  • 333
  • 5
  • 23

1 Answers1

1

try run the task not silently but with output-forwarding to a file:

RAILS_ENV=staging bundle exec nohup cinemas:import >/tmp/log.txt 2>&1

so for the has special wrappers, which should be run to setup proper environment, like follows:

* * * * * cd folder; RAILS_ENV=staging /usr/local/rvm/wrappers/ruby-2.1.1@projectX/bundle exec nohup cinemas:import >/tmp/log.txt 2>&1

if you are using the , the script runner will be seen as follows:

* * * * * /bin/bash -c '. $HOME/.rbenv/loader.sh; cd folder ; RAILS_ENV=staging bundle exec cinemas:import >/tmp/log.txt 2>&1'
Community
  • 1
  • 1
Малъ Скрылевъ
  • 16,187
  • 5
  • 56
  • 69