Преглед изворни кода

Command line switch -paused

Jakob Borg пре 10 година
родитељ
комит
baa87bc823
1 измењених фајлова са 8 додато и 0 уклоњено
  1. 8 0
      cmd/syncthing/main.go

+ 8 - 0
cmd/syncthing/main.go

@@ -201,6 +201,7 @@ var (
 	logFile           string
 	auditEnabled      bool
 	verbose           bool
+	paused            bool
 	noRestart         = os.Getenv("STNORESTART") != ""
 	noUpgrade         = os.Getenv("STNOUPGRADE") != ""
 	guiAddress        = os.Getenv("STGUIADDRESS") // legacy
@@ -239,6 +240,7 @@ func main() {
 	flag.StringVar(&upgradeTo, "upgrade-to", upgradeTo, "Force upgrade directly from specified URL")
 	flag.BoolVar(&auditEnabled, "audit", false, "Write events to audit file")
 	flag.BoolVar(&verbose, "verbose", false, "Print verbose log output")
+	flag.BoolVar(&paused, "paused", false, "Start with all devices paused")
 
 	flag.Usage = usageFor(flag.CommandLine, usage, fmt.Sprintf(extraUsage, baseDirs["config"]))
 	flag.Parse()
@@ -633,6 +635,12 @@ func syncthingMain() {
 		m.StartDeadlockDetector(20 * time.Minute)
 	}
 
+	if paused {
+		for device := range cfg.Devices() {
+			m.PauseDevice(device)
+		}
+	}
+
 	// Clear out old indexes for other devices. Otherwise we'll start up and
 	// start needing a bunch of files which are nowhere to be found. This
 	// needs to be changed when we correctly do persistent indexes.