github.com/divyam234/rclone@v1.64.1/fs/daemon_unix.go (about)

     1  // Daemonization interface for Unix platforms (common definitions)
     2  
     3  //go:build !windows && !plan9 && !js
     4  // +build !windows,!plan9,!js
     5  
     6  package fs
     7  
     8  import (
     9  	"os"
    10  )
    11  
    12  // We use a special environment variable to let the child process know its role.
    13  const (
    14  	DaemonMarkVar   = "_RCLONE_DAEMON_"
    15  	DaemonMarkChild = "_rclone_daemon_"
    16  )
    17  
    18  // IsDaemon returns true if this process runs in background
    19  func IsDaemon() bool {
    20  	return os.Getenv(DaemonMarkVar) == DaemonMarkChild
    21  }