在本地服务器上(ubuntu)我已经安装了程序foodsoft,它是用ruby编写的。它也使用bundler,mysql。 foodsoft可以通过在命令cronjob不能正确执行脚本
RAILS_ENV=production bundle exec rails s -b 192.168.0.15
我也有一个程序性sh脚本,开始foodsoft启动,如果它不运行:
#!/bin/sh
export DISPLAY=:0
export LANG=de_DE.utf8
ip_adr=$(/bin/hostname -I)
if [ $(pidof ruby) ]
then
echo "online"
else
echo "offline"
cd /home/jondal/foodsoft
RAILS_ENV=production bundle exec rails s -b $ip_adr
fi
如果我在shell中运行脚本,所有工作正常。但是我的cronjob(列在crontab中)并没有完全执行脚本。它产生以下txt文件:
离线 在/ usr/local/bin目录/包:
offline bundler: command not found: rails Install missing gem executables with `bundle install`
如果我与前缀ENV -i我碰到下面的shell启动的sh脚本:23:在
load': cannot load such file -- /usr/share/rubygems-integration/1.9.1/gems/bundler-1.3.5/bin/bundle (LoadError) from /usr/local/bin/bundle:23:in
'
你有什么想法我可以做什么?
您使用的是rvm吗?您可能需要采取一些额外步骤,以使rvm与crontab配合使用。 –
你的'cron'用户在'/ home/jondal/foodsoft'目录中有权限吗?具体来说,执行权限是否正确,特别是在'bin /'中? –