diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 6e839bfb..67ad2706 100644 --- a/cmd/syncthing/main.go +++ b/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.