HAMMER: Add "hammer abort-cleanup" command
authorJohn Marino <draco@marino.st>
Sun, 5 Apr 2015 11:06:49 +0000 (13:06 +0200)
committerJohn Marino <draco@marino.st>
Wed, 20 May 2015 08:21:09 +0000 (10:21 +0200)
commita360fddeb570fb9649151b00d79c90c61a6d3eab
tree8ff7c3ac7206dfb36f8bb2c8071a85e434cc242d
parent6daaa2c03b2cb7305ac022bcfe4ba0ba46b5d854
HAMMER: Add "hammer abort-cleanup" command

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.
sbin/hammer/Makefile
sbin/hammer/cmd_abort.c [new file with mode: 0644]
sbin/hammer/cmd_cleanup.c
sbin/hammer/hammer.8
sbin/hammer/hammer.c
sbin/hammer/hammer.h
sbin/hammer/hammer_util.h