The memcached on the line is dead again. Still not getting the core file.
For troubleshooting reasons, a colleague discovers that there is a suspicious problem with the script that launches memcached.Issue One: memcached working folder is not set, it is possible that core dump does not have working folder Write permissionThese scripts are started by crontab. The working folder is not set in the script. This is a non-root user's crontab. When you start memcached, the working folder is not the folder where the memcached executable file resides. The experiment proves that this is the user's home folder, Crontab executes the script in print pwd, the result is "home/work", work is the current user. Issue two: Ulimit-c Unlimited set in/etc/profile is not valid for crontab scripts
After reviewing the relevant documentation. The settings in/etc/profile are only valid for the login shell, and the shell environment that Crontab executes the script is non-login and does not load the/etc/profile settings.
here it is. Need to summarize the difference between/etc/profile and/ETC/BASHRC. And the difference between interactive and noninteractive, login and non-login shell concepts.
familiar with Linux programs apes should have had experience with setting environment variables in the ~/.profile file, the environment variables set in ~/.profile will only work for that one user. If you want to be valid for all users, set the/etc/profile. /etc/profile is the global version number of ~/.profile. In fact. Once an interactive login shell is opened, or a non-interactive shell logged in with the--login option. The commands in/etc/profile are loaded and run first, and then the commands in ~/.bash_profile, ~/.bash_login, and ~/.profile are loaded in turn.
This involves interactive shell and non-interactive shell,login The shell and non-login shell concept. According to these two dimensions, there are four types of shells in common: interactive login shell, interactive non-login shell, and non-interactive login shell. Non-interactive non-login shell.
Interactive : As the name implies. When the command in this shell is entered interactively by the user from the keyboard, the results of the execution can also be output to the terminal to display to the user.
non-interactive : Such a shell may be initiated by some of its own proactive processes and cannot be directly requested from the user's input. Also cannot directly output the result to the end user to see. The output is best written to a file.
login : for bash, for example, starts with "-bash".
When bash starts with the login shell, it runs the commands in/etc/profile and then/etc/profile calls all the scripts under the/ETC/PROFILE.D folder. Then run ~/.bash_profile. ~/.bash_profile calls ~/.BASHRC, and finally ~/.BASHRC calls/ETC/BASHRC.
To identify whether a shell is a login shell. Just run echo $ under the shell:
# echo
Suppose the output is the shell name, plus a '-' prefix. Indicates that the shell is the login shell. like-bash,-su and so on. Experiment. Under my Ubuntu system. Open terminal, enter echo $, and get "bash", which means it's not a login shell. SSH to the server and run the same command. Obtained the result of "-bash", indicating that SSH landed as login shell.
Non-login : A shell that does not require login and is started by some programs.
The number of references passed to the shell is not prefixed with '-'. Also take bash as an example. When started in non-login mode, it calls ~/.BASHRC. The/ETC/BASHRC is then called in ~/.BASHRC. Finally/ETC/BASHRC calls the script under all/ETC/PROFILE.D folders.
This is interested in being able to open these files for a look. The shell that is not login is primarily a shell that starts with "#su", "#su USERNAME". and graphics terminals (such as Ubuntu Terminal), running scripts, and so on.
To identify the non-login shell method or run the #echo $ command, the resulting result assumes that there is no '-' prefix. That is not a login.
Back to the problem we encountered, the shell of the script launched in Crontab was non-login. Then the commands in/etc/profile are not loaded. The "Ulimit-c Unlimited" command that we set up in/etc/profile is also invalid for scripts that are started in crontab, so the memcached that are started in these scripts will not have a core file when they are accidentally hung.
/etc/profile and/ETC/BASHRC, interactive and non-interactive, login and non-login shell differences