github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/fs/daemon_unix.go (about)

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