"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rcd: implement new command just to serve the remote control API
Nick Craig-Woodcff75db6a4f6
diff --git a/cmd/all/all.go b/cmd/all/all.goindex dcb7e8353..004a986cb 100644--- a/cmd/all/all.go+++ b/cmd/all/all.go@@ -43,6 +43,7 @@ import (_ "github.com/ncw/rclone/cmd/purge"_ "github.com/ncw/rclone/cmd/rc"_ "github.com/ncw/rclone/cmd/rcat"+ _ "github.com/ncw/rclone/cmd/rcd"_ "github.com/ncw/rclone/cmd/reveal"_ "github.com/ncw/rclone/cmd/rmdir"_ "github.com/ncw/rclone/cmd/rmdirs"diff --git a/cmd/rcd/rcd.go b/cmd/rcd/rcd.gonew file mode 100644index 000000000..f86655270--- /dev/null+++ b/cmd/rcd/rcd.go@@ -0,0 +1,42 @@+package rcd++import (+ "log"++ "github.com/ncw/rclone/cmd"+ "github.com/ncw/rclone/fs/rc"+ "github.com/ncw/rclone/fs/rc/rcflags"+ "github.com/spf13/cobra"+)++func init() {+ cmd.Root.AddCommand(commandDefintion)+}++var commandDefintion = &cobra.Command{+ Use: "rcd <path to files to serve>*",+ Short: `Run rclone listening to remote control commands only.`,+ Long: `+This runs rclone so that it only listents to remote control commands.++This is useful if you are controlling rclone via the rc API.++If you pass in a path to a directory, rclone will serve that directory+for GET requests on the URL passed in. It will also open the URL in+the browser when rclone is run.+`,+ Run: func(command *cobra.Command, args []string) {+ cmd.CheckArgs(0, 1, command, args)+ if rcflags.Opt.Enabled {+ log.Fatalf("Don't supply --rc flag when using rcd")+ }+ // Start the rc+ rcflags.Opt.Enabled = true+ if len(args) > 0 {+ rcflags.Opt.Files = args[0]+ }+ rc.Start(&rcflags.Opt)+ // Run the rc forever+ select {}+ },+}