Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Perl/UNIX .profile problem

by marcelo.magallon (Acolyte)
on Nov 18, 2004 at 16:46 UTC ( [id://408804]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl/UNIX .profile problem
in thread Perl/UNIX .profile problem

Actually it's not that cronjobs run in a restricted shell, the problem is that the OP is writing this settings to ~/.profile, which according to the docs:

When Bash is invoked as an interactive login shell, or as a non-interactive shell with the `--login' option, it first reads and executes commands from the file `/etc/profile', if that file exists. After reading that file, it looks for `~/.bash_profile', `~/.bash_login', and `~/.profile', in that order, and reads and executes commands from the first one that exists and is readable.

Pardon me for quoting the Bash docs, but this applies to any Bourne-type Shell.

Translated to english: the shell that runs a cronjob is not an interactive shell, therefor your profile is not being read. There might be no shell at all (depending on the cron implementation). This is way your carefully crafted PATH sometimes doesn't work when calling things from a cronjob. You can either do what brother Zaxo says, or you can write a shell script and put all your settings there (PATH, SECTRAN_DIR, PERL5LIB, whatever).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://408804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found