hughsimpson / sigterms

Customise responses to various `-signal_number`s sent via kill to a scala process


Stolen wholesale from Paul Phillips' code ( and related files), with minor modifications made to make it compatible with scala 2.11 (mostly involving import statemts)

example usage:

Include the dependency in your build.sbt / Build.scala / what-have-you

  resolvers += "silasmariner" at ""
  libraryDependencies += "org.silasmariner" %% "sigterms" % "0.1.0"


  import sigterms.SignalManager
  SignalManager.requireInterval(60, SignalManager.HUP) { // Custom response to `kill -1` message
    case true => println("Closing all IO!")
    case false => // 60s grace period not over. Do nothing.