<andreas.cahen / gmail.com> schrieb im Newsbeitrag 
news:1111334766.888543.173130 / l41g2000cwc.googlegroups.com...
> Unfortunately it didn't help at all..
>
> Well.. this is my crontab entry
> # 0 0,6,12,18 * * * /backups/scripts/batch_delete.sh
>
> This is the batch_delete.sh
> #! /bin/bash
> /usr/bin/ruby /backups/scripts/delete_old.rb
> /usr/bin/ruby /backups/scripts/spn_delete_old.rb
>
> and this is delete_old.rb
> #!/usr/bin/ruby
> require 'dbi'
> require 'pp'
> require 'date'
> values = {}
> count  = 0
> id = ''
> id2 = ''
> DBI.connect('DBI:Mysql:test', 'test', 'test') do | dbh |
>  puts "selecting..."
>  dbh.select_all("SELECT ID FROM `tb_replication_shipment` WHERE
> `createdTimeStamp` < date_sub( now( ) , INTERVAL 30 DAY)") do | row
> |
>    count = count + 1
>    id = row[0]
>    dbh.do("delete FROM tb_replication_shipmentHistory WHERE
> ID_Shipment = #{id}")
>    dbh.do("delete from tb_replication_shipment WHERE ID = #{id}")
>  end
>  puts "#{count} entries were deleted from the system"
>  dbh.do("optimize table tb_replication_shipment,
> tb_replication_shipmentHistory")
> end
>
>
> I don't get it why it's not working as a cronjob and then again it's
> working fine when executed from the shell.. :/
>
> thanks,
>
> -Andreas

Try doing this on the shell and set $LOAD_PATH accordingly before the first 
require:

ruby -e 'puts $LOAD_PATH.join(":")'

Alternatively you might have a permissions problem but I think path is more 
likely.

Kind regards

    robert