HAMMER: Add "hammer abort-cleanup" command

Operating Systems / DragonFlyBSD - John Marino [marino.st] - 20 May 2015 03:21 UTC

A new command has been added to HAMMER: abort-cleanup. As could be deduced from its name, this command will terminate all active cleanup operations. It takes no arguments.

It works by searching the /var/run directory for pidfiles starting with "hammer.cleanup.". It gets the pid from the filename rather than by reading the contents of the pidfile. Once the pid is obtained, the SIGTERM signal is set to it. Any successfully terminated process will be announced on stdout.

The SIGINT signal could also be used, but this one does not print "Terminated" on the process's terminal, which I find useful.

Currently if the cleanup is interrupted another way, the pidfile will not be removed. These hammer.cleanup pidfiles will accumulate until the next "hammer abort-cleanup" command is executed. Stale pidfiles will be removed if encountered by abort-cleanup command.

a360fdd HAMMER: Add "hammer abort-cleanup" command
sbin/hammer/Makefile | 2 +-
sbin/hammer/cmd_abort.c | 97 +++++++++++++++++++++++++++++++++++++++++++++
sbin/hammer/cmd_cleanup.c | 16 +++++++-
sbin/hammer/hammer.8 | 7 +++-
sbin/hammer/hammer.c | 7 +++-
sbin/hammer/hammer.h | 3 +-
sbin/hammer/hammer_util.h | 7 ++++
7 files changed, 131 insertions(+), 8 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share