From: Thien Vuong Date: 2003-03-31T12:12:31+09:00 Subject: Re: ruby and cron help Mark Probert wrote: > Hi, rubyists. > > I think this is more a cron rather than a ruby problem. > However, I am stumped. > > I am running ruby 1.6.8 under Solaris 6. > > wcary3zg:~/src/ruby/utils% crontab -l > 0,15,30,45 * * * * /opt/home/mark/bin/blah > > wcary3zg:~/src/ruby/utils% cat ~/bin/blah > #! /usr/local/bin/zsh > cd ~/src/ruby/utils > /usr/local/bin/ruby timestamp.rb > ~/tmp/timestamp.out > /usr/local/bin/ruby blah.rb > ~/tmp/blah.out > > timestamp.rb contains "puts Time.now" just to show that > ruby is working ok. blah.rb is the application I am > really interested in. Running "blah" from the command > line works fine. It fails to work from cron, though > the command is executed (from /var/cron/log) and the > timestamp.out file is updated. > > Any ideas? > Just to make sure all the output from the command are captured, you may want to do this. cd ~/src/ruby/utils /usr/local/bin/ruby timestamp.rb > ~/tmp/timestamp.out 2>&1 /usr/local/bin/ruby blah.rb > ~/tmp/blah.out 2>&1 and check the output Also, if your login shell is not of the csh variety, try testing it with rsh localhost /opt/home/mark/bin/blah This emulates pretty well the cron execution environment. cron run a program with almost none of your environment, so you need to setup most environment variables that is normally in .profile/.cshrc