Skip to content

Commit

Permalink
Fix: Signal parent once child takes over
Browse files Browse the repository at this point in the history
  • Loading branch information
voyvodov committed Sep 18, 2024
1 parent 92b9cba commit 8107a99
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func main() {
kill(os.Getpid(), syscall.SIGUSR1)
wg.Wait()
defer ctx.Release()

// Signal parent process since we are taking over
_ = kill(os.Getppid(), syscall.SIGUSR1)
}

} else {
Expand All @@ -209,17 +212,11 @@ func main() {
flags)

if err != nil {
if !flags.Foreground {
kill(os.Getppid(), syscall.SIGUSR2)
}
// log.Fatalf("Mounting file system: %v", err)
log.Fatalf("Mounting file system: %v", err)
// fatal also terminates itself
log.Printf("Mounting file system: %v", err)
return
} else {
if !flags.Foreground {
kill(os.Getppid(), syscall.SIGUSR1)
}
log.Println("File system has been successfully mounted.")

if flags.PidFile != "" {
Expand Down

0 comments on commit 8107a99

Please sign in to comment.