Is there a command to close a program with dump?

I'm running into some problems using pkill in my scripts. I'm using a program that needs to dump.

kill -SEGV pid

will work on most systems to generate a core dump. pid is the process id.

1 Like

Don't suppose that works with pkill, does it?

---------- Post updated at 11:04 PM ---------- Previous update was at 10:11 PM ----------

Hmm... I see it does work with pkill, but it's not giving the result I want.

The program updates it's configuration file when it closes normally. When you terminate it, it doesn't do that. It also doesn't do that with the SEGV signal. I just tried using INT and QUIT, but they didn't close it at all.

Any other signals worth trying?

We thought you meant a coredump. As in, kill the program instantly and save a crash dump -- rather the opposite of politely update files and exit normally! :slight_smile:

For more normal modes of termination you can try SIGTERM, SIGQUIT, SIGINT, SIGHUP. Whether and how it responds to these signals is of course program-dependent, but SIGHUP is often used to cause a daemon to reload config files and/or rotate logfiles. SIGUSR1 might also be useful if your software catches it for any use, it has no preassigned function so software uses it for whatever the programmer pleases.

1 Like

None of those signals seemed to work. INT and QUIT did nothing at all. TERM, HUP and USR1 closed the program, but did not allow it to update its config file.

I think I'm going to contact the developer. There is another problem I'm having with the program, so I need to get in touch with him anyway.

---------- Post updated 04-02-11 at 01:06 AM ---------- Previous update was 03-02-11 at 11:36 PM ----------

I messed with it a bit more and realized this problem only occurs when the program is run with a user-defined config file, so it's a problem with the program, not my commands.

I've contacted the developer.

Thanks guys.