Check the PATH
you have when you login against the one crontab
gives you. It may be quite different. rvm
does other things as well as set the path. You'll need to make sure our PATH
is correct, and run the script that rvm puts in your login
profile [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
. You could try running . ~/.bash_profile ; (path_to_script)/update.sh
as the crontab
command.
Update of blog site via cron does not work
Frage
Currently i have blog site which works with Octopress in relationship with Git but currently facing a problm that i can't update the site automatically via a cron triggered script. I'm using a script (update.sh) with the following contents:
#!/bin/bash -x
export PATH=/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/:/usr/local/rvm/bin/rvm:$PATH
cd /usr/local/repositories
cd supose.git
git fetch -q --all
cd /usr/local/vhost/octopress
git pull
rake generate
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/jekyll generate
But i alway get the following error message:
+ rake generate
## Generating Site with Jekyll
+ /usr/local/rvm/gems/ruby-2.0.0-p247/bin/jekyll generate
invalid command. Use --help for more information
I know there must be a relationship with the environment, but i can't get the point to get it running.
If i login into the machine and cd into the folder and do rake generat
it works like a charm.
Lösung
Andere Tipps
instead of changing PATH use a wrapper - this will provide environment for your ruby:
rvm wrapper ruby-2.0.0-p247 --no-links rake jekyll
and then use it like this:
/usr/local/rvm/wrappers/ruby-2.0.0-p247/rake generate
/usr/local/rvm/wrappers/ruby-2.0.0-p247/jekyll generate
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow