0

I have a cron job creating dynamic files and sending emails to system users. I need to set the language within the cron job so gettext and date formats work when creating the dynamic emails.

I cannot set the LANG in the /etc/environment file because the language is not static. Lets say the cron sends 10 different emails to 10 users - each could have a different language.

When I run my script in a webpage where I can set the session variables with putenv("LC_ALL".LANG); setlocale(LC_ALL,LANG.".utf8"); Everything works great. I am guessing since the cron doesn't create a session, these are ineffective.

Any ideas on how I can set this variable dynamically within a cron?

Jennifer
  • 158
  • 5

1 Answers1

0

Figured it out. I forgot to bindtextdomain. It is something that is automatically done on the website but I added it to the cron script and all is well.

Jennifer
  • 158
  • 5