How can I automatically set the core dump size on a single user?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am running OpenSUSE. I usually open the console with an interactive non-login shell bash
, and frequently use tcsh
after logon. I am writing some C
code, compiling with gcc
, and I'd like to have the core dump files created whenever an executable fails.
I know I can select manually the core dump size to be unlimited, but I don't want to type
limits coredumpsize unlimited
in tcsh
or
ulimit -c unlimited
in the default shell bash
every time I log on as my user.
Is there a way to set the core dump size automatically whenever I logon as user in bash
and/or tcsh
?
memory opensuse ulimit core-dump
add a comment |Â
up vote
0
down vote
favorite
I am running OpenSUSE. I usually open the console with an interactive non-login shell bash
, and frequently use tcsh
after logon. I am writing some C
code, compiling with gcc
, and I'd like to have the core dump files created whenever an executable fails.
I know I can select manually the core dump size to be unlimited, but I don't want to type
limits coredumpsize unlimited
in tcsh
or
ulimit -c unlimited
in the default shell bash
every time I log on as my user.
Is there a way to set the core dump size automatically whenever I logon as user in bash
and/or tcsh
?
memory opensuse ulimit core-dump
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am running OpenSUSE. I usually open the console with an interactive non-login shell bash
, and frequently use tcsh
after logon. I am writing some C
code, compiling with gcc
, and I'd like to have the core dump files created whenever an executable fails.
I know I can select manually the core dump size to be unlimited, but I don't want to type
limits coredumpsize unlimited
in tcsh
or
ulimit -c unlimited
in the default shell bash
every time I log on as my user.
Is there a way to set the core dump size automatically whenever I logon as user in bash
and/or tcsh
?
memory opensuse ulimit core-dump
I am running OpenSUSE. I usually open the console with an interactive non-login shell bash
, and frequently use tcsh
after logon. I am writing some C
code, compiling with gcc
, and I'd like to have the core dump files created whenever an executable fails.
I know I can select manually the core dump size to be unlimited, but I don't want to type
limits coredumpsize unlimited
in tcsh
or
ulimit -c unlimited
in the default shell bash
every time I log on as my user.
Is there a way to set the core dump size automatically whenever I logon as user in bash
and/or tcsh
?
memory opensuse ulimit core-dump
edited Mar 26 at 8:01
asked Mar 23 at 1:56
Andrea L.
1014
1014
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
After a bit of research I may have solved the problem. Once I login to the UNIX machine, it redirects me to the home
directory, according to the shell chosen, from the available ones on the system from the file etcpasswd
as follows:
alandella:x:1000:100:alandella:/home/alandella:/bin/bash
This explains the non-login interactive bash
shell (konsole). The shell, let it be bash
or tcsh
runs, and the following files are read at login/logout:
~/.login -> Executes cmds at login
~/.tcshrc -> same as ~./bashrc in bash and ~./cshrc in csh
~/.logout -> at logout
So, by adding the following lines to the ~/.tcshrc
and ~/.bashrc
files:
~/.bashrc -> ulimit -Sc X
~/.tcshrc -> limit coredumpsize X
where X
is a value (kB) or unlimited
, and it should do the trick.
Sometimes, it is told to also edit the ~/.profile
file. I did not edit it, even if MY bash
shell sources it at login. Why does it not make a difference? Because I always use a non-login shell, as I double-click konsole to open the terminal. The ~/.profile
file is sourced at startup only in a login shell (usually sh
, which I do not use). I have bash
that looks at the following files in sequence:
.bash_profile -> .bash_login -> .profile
in MY case, the first two files do not exist, so bash
sources .profile
if I use a login shell.
NOTE. This operation must be done as root, and in order to make this trick work, the following conditions must/should be met:
That the file
/etc/security/limits.conf
sets suitable hard/soft limits for the user and root. If a hard limit of the core dump size of 2000 kB is imposed, then when we modify~/.bashrc
with 3000 kB, the core dump size limit will continue to be 2000 kB. Lookuplimits.conf
.That the files under
/etc/pam.d
contain thesession required pam_limits.so
line, in order to allow the/etc/security/limits.conf
settings to take place.That the file
/etc/sysctl.conf
containskernel.core_pattern = core.%e.%p
, this sets the format of the generated core files, where %e is the executable filename and %p is the pid.
Note: the~/.bashrc
,~/.cshrc
and~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. Theulimit
orlimit
you need, has to be called only once and so has to be called within~/.profile
or~/.login
.
â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
After a bit of research I may have solved the problem. Once I login to the UNIX machine, it redirects me to the home
directory, according to the shell chosen, from the available ones on the system from the file etcpasswd
as follows:
alandella:x:1000:100:alandella:/home/alandella:/bin/bash
This explains the non-login interactive bash
shell (konsole). The shell, let it be bash
or tcsh
runs, and the following files are read at login/logout:
~/.login -> Executes cmds at login
~/.tcshrc -> same as ~./bashrc in bash and ~./cshrc in csh
~/.logout -> at logout
So, by adding the following lines to the ~/.tcshrc
and ~/.bashrc
files:
~/.bashrc -> ulimit -Sc X
~/.tcshrc -> limit coredumpsize X
where X
is a value (kB) or unlimited
, and it should do the trick.
Sometimes, it is told to also edit the ~/.profile
file. I did not edit it, even if MY bash
shell sources it at login. Why does it not make a difference? Because I always use a non-login shell, as I double-click konsole to open the terminal. The ~/.profile
file is sourced at startup only in a login shell (usually sh
, which I do not use). I have bash
that looks at the following files in sequence:
.bash_profile -> .bash_login -> .profile
in MY case, the first two files do not exist, so bash
sources .profile
if I use a login shell.
NOTE. This operation must be done as root, and in order to make this trick work, the following conditions must/should be met:
That the file
/etc/security/limits.conf
sets suitable hard/soft limits for the user and root. If a hard limit of the core dump size of 2000 kB is imposed, then when we modify~/.bashrc
with 3000 kB, the core dump size limit will continue to be 2000 kB. Lookuplimits.conf
.That the files under
/etc/pam.d
contain thesession required pam_limits.so
line, in order to allow the/etc/security/limits.conf
settings to take place.That the file
/etc/sysctl.conf
containskernel.core_pattern = core.%e.%p
, this sets the format of the generated core files, where %e is the executable filename and %p is the pid.
Note: the~/.bashrc
,~/.cshrc
and~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. Theulimit
orlimit
you need, has to be called only once and so has to be called within~/.profile
or~/.login
.
â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
add a comment |Â
up vote
0
down vote
accepted
After a bit of research I may have solved the problem. Once I login to the UNIX machine, it redirects me to the home
directory, according to the shell chosen, from the available ones on the system from the file etcpasswd
as follows:
alandella:x:1000:100:alandella:/home/alandella:/bin/bash
This explains the non-login interactive bash
shell (konsole). The shell, let it be bash
or tcsh
runs, and the following files are read at login/logout:
~/.login -> Executes cmds at login
~/.tcshrc -> same as ~./bashrc in bash and ~./cshrc in csh
~/.logout -> at logout
So, by adding the following lines to the ~/.tcshrc
and ~/.bashrc
files:
~/.bashrc -> ulimit -Sc X
~/.tcshrc -> limit coredumpsize X
where X
is a value (kB) or unlimited
, and it should do the trick.
Sometimes, it is told to also edit the ~/.profile
file. I did not edit it, even if MY bash
shell sources it at login. Why does it not make a difference? Because I always use a non-login shell, as I double-click konsole to open the terminal. The ~/.profile
file is sourced at startup only in a login shell (usually sh
, which I do not use). I have bash
that looks at the following files in sequence:
.bash_profile -> .bash_login -> .profile
in MY case, the first two files do not exist, so bash
sources .profile
if I use a login shell.
NOTE. This operation must be done as root, and in order to make this trick work, the following conditions must/should be met:
That the file
/etc/security/limits.conf
sets suitable hard/soft limits for the user and root. If a hard limit of the core dump size of 2000 kB is imposed, then when we modify~/.bashrc
with 3000 kB, the core dump size limit will continue to be 2000 kB. Lookuplimits.conf
.That the files under
/etc/pam.d
contain thesession required pam_limits.so
line, in order to allow the/etc/security/limits.conf
settings to take place.That the file
/etc/sysctl.conf
containskernel.core_pattern = core.%e.%p
, this sets the format of the generated core files, where %e is the executable filename and %p is the pid.
Note: the~/.bashrc
,~/.cshrc
and~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. Theulimit
orlimit
you need, has to be called only once and so has to be called within~/.profile
or~/.login
.
â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
After a bit of research I may have solved the problem. Once I login to the UNIX machine, it redirects me to the home
directory, according to the shell chosen, from the available ones on the system from the file etcpasswd
as follows:
alandella:x:1000:100:alandella:/home/alandella:/bin/bash
This explains the non-login interactive bash
shell (konsole). The shell, let it be bash
or tcsh
runs, and the following files are read at login/logout:
~/.login -> Executes cmds at login
~/.tcshrc -> same as ~./bashrc in bash and ~./cshrc in csh
~/.logout -> at logout
So, by adding the following lines to the ~/.tcshrc
and ~/.bashrc
files:
~/.bashrc -> ulimit -Sc X
~/.tcshrc -> limit coredumpsize X
where X
is a value (kB) or unlimited
, and it should do the trick.
Sometimes, it is told to also edit the ~/.profile
file. I did not edit it, even if MY bash
shell sources it at login. Why does it not make a difference? Because I always use a non-login shell, as I double-click konsole to open the terminal. The ~/.profile
file is sourced at startup only in a login shell (usually sh
, which I do not use). I have bash
that looks at the following files in sequence:
.bash_profile -> .bash_login -> .profile
in MY case, the first two files do not exist, so bash
sources .profile
if I use a login shell.
NOTE. This operation must be done as root, and in order to make this trick work, the following conditions must/should be met:
That the file
/etc/security/limits.conf
sets suitable hard/soft limits for the user and root. If a hard limit of the core dump size of 2000 kB is imposed, then when we modify~/.bashrc
with 3000 kB, the core dump size limit will continue to be 2000 kB. Lookuplimits.conf
.That the files under
/etc/pam.d
contain thesession required pam_limits.so
line, in order to allow the/etc/security/limits.conf
settings to take place.That the file
/etc/sysctl.conf
containskernel.core_pattern = core.%e.%p
, this sets the format of the generated core files, where %e is the executable filename and %p is the pid.
After a bit of research I may have solved the problem. Once I login to the UNIX machine, it redirects me to the home
directory, according to the shell chosen, from the available ones on the system from the file etcpasswd
as follows:
alandella:x:1000:100:alandella:/home/alandella:/bin/bash
This explains the non-login interactive bash
shell (konsole). The shell, let it be bash
or tcsh
runs, and the following files are read at login/logout:
~/.login -> Executes cmds at login
~/.tcshrc -> same as ~./bashrc in bash and ~./cshrc in csh
~/.logout -> at logout
So, by adding the following lines to the ~/.tcshrc
and ~/.bashrc
files:
~/.bashrc -> ulimit -Sc X
~/.tcshrc -> limit coredumpsize X
where X
is a value (kB) or unlimited
, and it should do the trick.
Sometimes, it is told to also edit the ~/.profile
file. I did not edit it, even if MY bash
shell sources it at login. Why does it not make a difference? Because I always use a non-login shell, as I double-click konsole to open the terminal. The ~/.profile
file is sourced at startup only in a login shell (usually sh
, which I do not use). I have bash
that looks at the following files in sequence:
.bash_profile -> .bash_login -> .profile
in MY case, the first two files do not exist, so bash
sources .profile
if I use a login shell.
NOTE. This operation must be done as root, and in order to make this trick work, the following conditions must/should be met:
That the file
/etc/security/limits.conf
sets suitable hard/soft limits for the user and root. If a hard limit of the core dump size of 2000 kB is imposed, then when we modify~/.bashrc
with 3000 kB, the core dump size limit will continue to be 2000 kB. Lookuplimits.conf
.That the files under
/etc/pam.d
contain thesession required pam_limits.so
line, in order to allow the/etc/security/limits.conf
settings to take place.That the file
/etc/sysctl.conf
containskernel.core_pattern = core.%e.%p
, this sets the format of the generated core files, where %e is the executable filename and %p is the pid.
answered Mar 26 at 10:09
Andrea L.
1014
1014
Note: the~/.bashrc
,~/.cshrc
and~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. Theulimit
orlimit
you need, has to be called only once and so has to be called within~/.profile
or~/.login
.
â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
add a comment |Â
Note: the~/.bashrc
,~/.cshrc
and~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. Theulimit
orlimit
you need, has to be called only once and so has to be called within~/.profile
or~/.login
.
â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
Note: the
~/.bashrc
, ~/.cshrc
and ~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. The ulimit
or limit
you need, has to be called only once and so has to be called within ~/.profile
or ~/.login
.â daniel Azuelos
Mar 26 at 11:06
Note: the
~/.bashrc
, ~/.cshrc
and ~/.tcshrc
are initialisation scripts which are read at each shell or subshell. If for example you run a shell script which make a loop running another subshell 1000 times, this initialisation script will be read 1000 times. The ulimit
or limit
you need, has to be called only once and so has to be called within ~/.profile
or ~/.login
.â daniel Azuelos
Mar 26 at 11:06
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
@danielAzuelos I tried that, but whenever I delete the lines in ~/.bashrc or ~/.tcshrc and add the new limit setting in ~/.profile, the soft limit for the core sticks at 0 for some wizardry I cannot wrap my head around
â Andrea L.
Mar 26 at 12:30
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432978%2fhow-can-i-automatically-set-the-core-dump-size-on-a-single-user%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password