]> gitweb.fluxo.info Git - puppet-runit.git/commitdiff
added ability to configure the finish script and provide a simple default one
authorMarkus Strauss <Markus@ITstrauss.eu>
Sun, 30 Oct 2011 21:41:19 +0000 (17:41 -0400)
committerMarkus Strauss <Markus@ITstrauss.eu>
Sun, 30 Oct 2011 21:41:19 +0000 (17:41 -0400)
manifests/service.pp
templates/finish.erb [new file with mode: 0644]

index 5d7d928f433bf780cb93a2984200581e751d9be5..4f886cfe1b2dfa1a74ed945753663896f9457c21 100644 (file)
@@ -3,12 +3,16 @@ define runit::service (
   $group   = root,       # the service's group name
   $enable  = true,       # shall the service be linked to /etc/service
   $ensure  = present,    # shall the service be present in /etc/sv
-  # either one of these three must be declared - it defines the content of the run script /etc/sv/$name/run
+  # start command - either one of these three must be declared - it defines the content of the run script /etc/sv/$name/run
   $command = undef,      # the most simple way;  just state command here - it may not daemonize itself,
                          # but rather stay in the foreground;  all output is logged automatically to $logdir/current
                          # this uses a default template which provides logging
   $source  = undef,      # specify a source file on your puppet master 
   $content = undef,      # specify the content directly (mostly via 'template')
+  # finish command - defines the content of the finish script /etc/sv/$name/finish
+  $finish_command = '',
+  $finish_source  = undef,
+  $finish_content = undef,
   # service directory - this is required if you use 'command'
   $rundir  = undef,
   # logging stuff
@@ -63,8 +67,17 @@ define runit::service (
       ensure  => $ensure,
       mode    => 755,
       ;
+    "${svbase}/finish":
+      content => $finish_content ? {
+        undef   => template('runit/finish.erb'),
+        default => $finish_content,
+      },
+      source  => $finish_source,
+      ensure  => $ensure,
+      mode    => 755,
+      ;
   }
-
+  
   # eventually enabling the service
   if $ensure == present and $enable == true {
     $_ensure_enabled = present
diff --git a/templates/finish.erb b/templates/finish.erb
new file mode 100644 (file)
index 0000000..787a174
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo "Stopping <%= name %>"
+<%= finish_command %>