Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from ibuildthecloud/pdeath
Browse files Browse the repository at this point in the history
Set parent death signal to shutdown when parent dies
  • Loading branch information
ibuildthecloud committed Oct 15, 2015
2 parents f0ef217 + 9abe9b9 commit 78ff824
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions manager/catalogManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ package manager
import (
"flag"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/rancher/rancher-catalog-service/model"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"syscall"
"time"
"strconv"

"gopkg.in/yaml.v2"

log "github.com/Sirupsen/logrus"
"github.com/rancher/rancher-catalog-service/model"
)

var (
Expand Down Expand Up @@ -54,6 +57,11 @@ func SetEnv() {
log.Fatal(err)
fmt.Errorf(err)
}

// Shutdown when parent dies
if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, uintptr(syscall.SIGTERM), 0); err != 0 {
log.Fatal("Failed to set parent death sinal, err")
}
}

func Init() {
Expand Down

0 comments on commit 78ff824

Please sign in to comment.