Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS appears to fall over during cron jobs

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS appears to fall over during cron jobs
  • Date: Wed, 7 Dec 2005 14:00:29 +0100

>
> Hi all,
> I'm running a Perl script that synchronises an SQL Server 7.0
> database on Win 2K with a MySQL one on Debian Sarge, via a FreeTDS
> (actually DBI:Sybase) connection. It runs from the bash shell of the
> Sarge box. It takes about 55 minutes to run, and if launched manually,
> by the synchronisation user, from the bash shell, it always runs to
> completion successfully (although it does throw out a
> "cs_diag(CS_INIT)
> failed" warning, right at the start).
> However, when I set the program to run with exactly the same set
> of parameters from the user's crontab, it fails on opening a table on
> the SQL Server database with a "Data conversion resulted in overflow"
> message. I understand what kind of problem the error is referring to,
> and the data in the offending SQL Server table contains datatypes such
> as nvarchar, for instance, which might explain it - but why the (very
> consistent) inconsistency between running the job manually and running
> it via cron? Why does the cron job always bomb, but the manual job
> always run to completion?
> Any suggestions are greatly appreciated.
>
> Daniel Walker

Usually this is due to different environments. For example LANG (and so
some connection settings) changes.
You could wrap your perl script in a bash script like

#!/bin/bash
. $HOME/.bashrc
exec /path/to/your/script.pl

I used bash instead of sh cause bash is the default shell and I loaded
.bashrc to load any use setting.
Changing environments can also change paths and similar so it can happen
that you are using different FreeTDS versions.
If wrapper works I would do some additional checks to see what
environment do the trick.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page