Reputation: 1269
I am planning to design an application in C/C++ that runs as demon process and collects core dumps as and when they happen along with the applications log files. Is there any way in Linux from where I can get to know an application has crashed.
Upvotes: 3
Views: 2772
Reputation: 4620
Another option (in addition to the other good suggestions so far) might be to set up /proc/sys/kernel/core_pattern to pipe the core file to an application as it is being created, as described here. The application can e.g. decide whether to create the core file or not, where to store the core file, compress the core file on the fly, or notify another application via IPC that the core file has been created.
Upvotes: 2
Reputation: 26910
First, you can change the directory which core dump file writes. In linux, it is /proc/sys/kernel/core_pattern
(see this blog)
Second, you can monitor a directory for changes, see Inotify - how to use it? - linux .
Just set the core pattern to a specific directory and monitor it for new files.
Upvotes: 6