Hi All,
I got a strange problem here. I have a perl script which is fetching data from a database table and writing a file with that data.
If i run that script from linux command line, the file it creates is a normal ascii text file without any binary character in it.But if i run it the same script through crontab, it is creating a data file with some binary characters appended in the data.
Did anybody faced this kind of situation before? Please help me if so?
Thanks in Advance!
I'd check environmental variables under cron .
pay special attention to IFS , PATH , LD_LIBRARY , and PERL*
set in crontab :
min hour * * * env > /tmp/env
and examine /tmp/env
So the shell is different while executing the script from cron.
Can you advise me how i can set it a particular shell so as the cron to use it
while executing a script?
So it's not the one which mess up my output. My mind is above the charset defined for crontab execution and the normal ones. I am not pretty sure this is the key and if that is where these are defined. Any idea?
I can't see a .profile file in my home. What's the code or settings to be done inside the .profile file if an creating one in my home?
---------- Post updated at 08:24 AM ---------- Previous update was at 05:08 AM ----------
Hi Guys,
I identified the problem, the problem is due to the incorrect value for the variable 'LC_CTYPE' in crontab's environment which deals with charset conversions.
I added the line in the file /etc/environment
LC_CTYPE="en_AU.UTF-8"
for the crontab to use it while executing scripts. It will have the same effect, if we add this line into /etc/security/pam_env.conf file as well.
The crontab will pick up env settings from these two files.