Add an exec daemon plugin (#4424)

This commit is contained in:
Jan Graichen
2020-02-28 19:46:03 +01:00
committed by GitHub
parent 0103691eb6
commit a20e6953d2
9 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package main
// Example using HUP signaling
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP)
counter := 0
for {
<-c
fmt.Printf("counter_go count=%d\n", counter)
counter++
}
}

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
## Example in Ruby not using any signaling
counter = 0
loop do
puts "counter_ruby count=#{counter}"
STDOUT.flush
counter += 1
sleep 1
end

View File

@@ -0,0 +1,12 @@
#!/bin/bash
## Example in bash using STDIN signaling
counter=0
while read; do
echo "counter_bash count=${counter}"
let counter=counter+1
done
(>&2 echo "terminate")