在本地服务器(ubuntu)上,我安装了程序foodsoft,这是用ruby编写的 . 它也使用了bundler,mysql . foodsoft可以通过命令启动
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文件:
offline
bundler: command not found: rails
Install missing gem executables with `bundle install`
如果我在shell中使用前缀env -i启动sh脚本,我会得到以下内容:
offline / usr / local / bin / bundle:23:in load':无法加载此类文件 - /usr/share/rubygems-integration/1.9.1/gems/bundler-1.3.5/bin/bundle(LoadError)来自/ usr / local / bin / bundle:23:in'
你有什么想法我能做什么吗?