Open cometbalan opened 10 years ago
What directory are you currently in when you run the task manually?
What directory should the task run in? Is it possibly a permissions issue?
I am running the jake task directly under my project directory. Below is the structure
my_project/app
my_project/jake/test-jakefile.js
The task runs even when i go to home directory (cd ~) and give absolute path for both jake and the jakefile.
What i found was, the PATH variable loaded during a cron seems not to have all the actual PATH information. I created a shell file (.sh) and added the PATH info as like below
PATH="/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/balan/local/bin:/home/balan/local/bin:/home/balan/local/bin:/home/balan/local/bin"
///jake invoke here
and add this .sh file to the cronjob, and it worked.
But i am wondering if there is a clean way to do this?
If I understand you correctly, the problem is that the Jake executable isn't in the PATH of the cron user. You can actually run Jake via the cli.js script -- the jake
executable is really just a symlink to that path. If you've installed it globally, it's probably at /usr/local/lib/node_modules/jake/bin/cli.js.
Consider the below jake task
I can able to execute this task when i run this like (with absolute path for jake and the jake file)
But when i add the below code in a crontab, this is not working. I have checked the cron log, this task is actually initiated, but there is no output. (every minute once)