Les fichiers 'core' générés par les applications sont placés par défaut dans le répertoire de travail.
Mais il est possible de spécifier un répertoire unique pour tous les fichiers 'core' en utilisant la commande 'syscorepath'.
Ainsi, on peut créer un système de fichiers spécifique dans lequel tous les 'core' générés seront stockés, évitant ainsi de saturer des systèmes de fichiers applicatifs.
La syntaxe est la suivante :
# syscorepath -p /tmp # Pour spécifier que les core doivent tous être stockés dans /tmp.
La commande 'syscorepath -g ' permet d'afficher le répertoire défini. Si la valeur est nulle, c'est le répertoire de travail (HOME ou répertoire courant) qui est utilisé.
Ci-dessous la documentation officielle.
syscorepath Command
Purpose
Specifies a single system-wide directory where all core files of any processes will be dumped.
Syntax
syscorepath [ -p DirectoryName ] [ -g ] [ -c ]
Description
The syscorepath command enables a system administrator to set up a single system-wide directory in which to dump core files from any processes.
This can ease administrative tasks in managing file-system space and provides a single, known directory in which to find core files. By default,
the core file is created in the working directory of the process being core-dumped.
The directory should have read and write privileges for all users on the system. If a user does not have permission to write in the directory, a
core file will not be created. Core files will be given unique names based on the process ID and time, so a core file will be named
core.pid.ddhhmmss, where pid is the process ID, dd is the day of the month, hh is the hour in 24-hour format, mm is minutes, and ss is seconds.
Note: The settings made by the syscorepath command do not persist across system reboots. However, the settings made by the chcore command persist
across system reboots.
Flags
Item
Description
-c
Unsets the current directory specified as the repository for core files. Subsequent core files will be created in the working directory of the
process.
-g
Displays current directory specified as the repository for core files.
-p DirectoryName
Specifies the directory to use as a repository for core files. DirectoryName must be a valid directory name.
Exit Status
Item
Description
0
The command completed successfully.
>0
An error occurred.
Standard Errors
EPERM
User does not have permission.
ENOTDIR
Specified DirectoryName is not a directory.
ENAMETOOLONG
Specified DirectoryName is too long.
Security
Only the root user can run this command.
Examples
1 To set /core as the repository for core files, type:
syscorepath -p /core
2 To display the current repository for core files, type:
syscorepath -g
3 To unset the directory used as the repository for core files, type:
syscorepath -c
Files
Item
Description
/usr/bin/syscorepath
Contains the syscorepath command.