How can the locale be set for processes started by boot scripts?
This thread is a continuation of an earlier thread which had an inappropriate title :doh:
How can the locale be set for processes started by boot scripts? For processes which are descendents of login shells, locale is set by /etc/profile.d/lang.*sh in which envar $LANG is set. For virtual terminals, locale is set by kernel parameter vt.default_utf8=1 (thanks Rupa). But how is it set for processes started by boot scripts which are direct descendents of the init process?
Looking around to find how it might be done, I discovered:
It would be nice to set the locale for Bacula only but that would require front-ending a lot of executables and I'm not confident of being able to identify them all.
Presumably both the daemon processes and the processes initiated by a logged-on user should have the same locale. One solution would be to export LANG=<something>.utf8 in the Bacula boot scripts and use /etc/profile.d/lang.*sh for the logged-on users but I'm curious how it can be set for all processes.
EDIT: Bacula is configured to use MySQL so presumably that, too, should have LANG=<something>.utf8.
* Available as PDF or HTML at http://www.bacula.org/en/?page=documentation)
Two ideas: modify individual boot scripts to pass the desired LOCALE to the process, or create wrappers for the called binaries which set the LOCALE before exec-ing the real program.
The first suggestion is the one I will go with if I can't find a way to set locale for the whole system by setting it earlier in the process tree.
I considered the second suggestion but rejected it because of the difficulty of identifying all the binaries, and it's a lot of work, and it might break if an upgrade introduced new binaries.
|All times are GMT -5. The time now is 02:58 AM.|