Background:
Due to the recent installation of Jira in Linux, after a Chinese plug-in is installed, once it is set to start up, it is in English, and after the terminal restarts again, it seems that the plug-in takes effect, it is restored to a normal Chinese interface. First, I think this involves an environment variable, because some variables cannot be found when I use service Jira start to set the startup service, for example, if the Home Directory of Java cannot be obtained, the system prompts that the home directory cannot be found. For this reason, I have added the Java environment variable to boot and started OK, but I do not know much about English, but I still want to use Chinese characters. Otherwise, the plug-in will be equivalent to Bai 'an.
To solve this problem, you need to find out the differences between the two environment variables. How to view the environment variables of a running program is as follows:
Method 1: Obtain the environment variable by obtaining the process ID:
Root@192.168.98.128 :~ # Ps aux | grep Jira
Root 2341 25.3 55.0 758544 384956 pts/0
Obtained PID: 2341
Run the following command to view the environment variables of the process:
PS Eww-P 2341 // obtain a large series of Environment Variables
Method 2: view the environment information in the proc directory and separate the environment variables.
Tr '\ 0' \ n' </proc/2341/environ
After diff differentiation, we can see two differences:
(1) term = Linux term = xterm // this may be because when I set xterm when using securecrt, this variable is brought in (in: session options-> terminal-> simulation-> terminal: xterm)
(2) lang = en_US.UTF-8 lang = zh_CN.UTF-8 // here is a terminal code problem: en_us and zh_cn are still different, here may be the problem.
For questions about Lang, refer to what I wrote: http://www.justwinit.cn/post/5425/
Now we can handle it like this:
Export lang = zh_CN.UTF-8
Place this line in the first line of the startup command/etc/init. d/Jira.
Export lang = zh_CN.UTF-8
Nohup/usr/local/Jira/bin/shutdown. Sh>/dev/null 2> & 1 & | ~
26 usleep 100000 | ~
27 nohup/usr/local/Jira/bin/startup. Sh>/dev/null 2> & 1 &
After the above modification, it was successful, and I guess it is correct.
Certificate -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Appendix Q: The shell script executed by nohup cannot be passed to the script for the newly set global variables?
Export logfile # export as an environment variable to be used by the 123. Sh Process
Nohup 123.sh &
========================================================== ==========
Of course, you do not need to use export. As long as the source script is used, the global variable is set to the current shell process, if you want it to be an environment variable so that it can be used by subsequent Shell Sub-processes, you need to use export.
I was thinking: Why didn't I read the value of this file when Jira was started? Strange: Is your Jira version too low.
VI/etc/sysconfig/i18n
The problem is resolved by matching the environment variables during startup and terminal running.
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The following is an additional reason for the difference between the environment variables after startup and the environment variables when the terminal is started:
First, it is clear that in Linux, both command line input and system settings are shell. (The startup setting is in (/etc/init. d/RCs), the shell that configures the system environment variable is located in/etc/profile, and the shell that configures the user-level environment variable is ~ /. Bashrc-execute each time the terminal is started; or ~ /. Bash_profile-executed when the session starts ). Add the library path to the environment variable ld_lib_path.
Memo:
1. When editing a command line, you can use the Emacs command to edit it. For example, Ctrl-B indicates to move the cursor back. CTRL-A indicates to move the cursor to the beginning.
2. You can enter several commands for execution in sequence: command1; command2 or command1 & command2 (execute command2 when command1 is executed successfully ).
3. Background running and program debug output redirection: after running a program on the terminal, you can use ctrl-Z to suspend and enter the BG command to run the program in the background (of course, you can also directly add & in the background &). Command &>/dev/null & the terminal will no longer output debugging information.
4. Output redirection: (1) Multiple command redirection, | for example, | grep text | less, and (2) redirect to the file command> file (replace the file content with the command output) or command> file (directly add the command output to the end of the file ).
5. Change the prompt by setting PS1 = "something.
6. Use alias newcommand = "oldcommand" to set the alias of the command.
1.2 boot startup and environment variable settings
1. Add the Startup Program to the shell file/etc/init. d/RCS.
2. Add environment variables to the/etc/profile file (path and LD_LIBRARY_PATH)