Try adding your environment settings into the crontab, like this:

* * * * * . $HOME./bashrc && /full/path/to/script/ARSperl-script.pl >>
/dev/null 2>&1





Regards,
Jarl



2010/7/8 Piotr Szlązak <piotr.szla...@gmail.com>:
> Hi!
> I'm want to create script for report generation. Script should be
> executed by crontab.
> This is a bash script which executes Perl script which is using
> ARSperl. Then bash script sends Perl script output via email.
>
> When this bash script is executed directly from CLI it runs fine. When
> executed via crontab - every time it ends with segmentation fault.
> Also Perl script executed via crontab ends without any error.
> After some checks I found out that it is enough to use ars_Login
> subroutine to get this error.
>
> Basic script:
>> cat ARSperl-script.pl
> #!/usr/bin/perl
>
> use strict;
> use ARS;
> my $server = 'server.address.com';
> my $user = 'username';
> my $pass = 'password';
>
> #Logging in to the server
> ( my $ctrl = ars_Login( $server, $user, $pass ,'', '', 2121, '' ) )
>        || die "ars_Login failed: $ars_errstr";
> print "Connected...\n";
>
> ars_Logoff($ctrl);
>
> Bash script which is executed via crontab:
>> cat ARSperl-report.sh
> #!/bin/bash
>
> /full/path/to/script/ARSperl-script.pl >> /dev/null 2>&1
>
> I checked that Perl script gathers needed data and gives proper
> output. But I'm always receiving similar mail from Cron daemon:
> /full/path/to/script/ARSperl-report.sh: line 3:  3599 Segmentation
> fault      /full/path/to/script/ARSperl-script.pl >> /dev/null 2>&1
>
> Exit code for this Perl script execution is 139. But as I mentioned -
> only when bash script is executed via crontab.
>
> I need to have clean exit code, because after Perl script call, I'm
> making decision what should be sent - Perl script output or only
> warning about problems.
>
> Can somebody check if same problem occurs on its platform? Maybe
> somebody knows how to solve this problem?
>
> Perl version: 5.10.1
> ARSperl version: 1.91
> ARS API version 13
> OS: Debian Linux
>
> --
> petee
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>
>
> --
> Arsperl-users mailing list
> Arsperl-users@arsperl.org
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first


--
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to