sourcing in perlscript run by crontab

Arun arun.george.1981 at gmail.com
Sun Oct 21 07:13:45 UTC 2007


That is right. Cron does not read from bashrc at all. I also tried sourcing
it in perl script.
But no use. I read thru cron's manual and so set the variable in crontab
itself and it worked.
Thanks for your time, andrew.


On 10/21/07, Andrew Glen-Young <aglenyoung at gmail.com> wrote:
>
> On 20/10/2007, Arun <arun.george.1981 at gmail.com> wrote:
> > Hi All,
> >
> > I have a crontab which calls a perlscript for building my project. I am
> > using the environment variabel CATALINA_HOME in it.
> > If I run the perl script manually the value of ${CATALINA_HOME} is
> correctly
> > interperetted.
> > But when I run the same perl script thru crontab the value is empty. I
> tried
> > sourcing the .bashrc file which contains the value.
> > export CATALINA_HOME='/usr/local/bin/apache-tomcat-6.0.13'
> > Even then the perl script that is run as crontask mistook the variable
> > having an empty value.
> >
> > What might be the reasons.?
> >
>
> I suggest that you have a thorough read of the crontab(5) man page.
>
> Cron will run with a restricted environment. If you want to use an
> environment variable, you will have to set it in the crontab or the
> script itself. Look for the 'EXAMPLE CRON FILE' section. Bash will not
> source your .bashrc or .bash_profile scripts when it is not run
> interactively and so any environment variables defined in these files
> will not be available to your crontab. Read the 'INVOCATION' section
> of the bash(1) man page for more.
>
> Regards.
> Andrew Glen-Young
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>



-- 
Thanks
Arun George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20071021/b283e60e/attachment.html>


More information about the ubuntu-users mailing list