mirror of
https://github.com/rclone/rclone.git
synced 2025-12-12 06:24:14 +01:00
rcd: obey --cluster if set to run as a cluster server
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/rclone/rclone/cmd"
|
"github.com/rclone/rclone/cmd"
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
|
"github.com/rclone/rclone/fs/cluster"
|
||||||
"github.com/rclone/rclone/fs/rc"
|
"github.com/rclone/rclone/fs/rc"
|
||||||
"github.com/rclone/rclone/fs/rc/rcflags"
|
"github.com/rclone/rclone/fs/rc/rcflags"
|
||||||
"github.com/rclone/rclone/fs/rc/rcserver"
|
"github.com/rclone/rclone/fs/rc/rcserver"
|
||||||
@@ -38,6 +39,8 @@ See the [rc documentation](/rc/) for more info on the rc flags.
|
|||||||
"groups": "RC",
|
"groups": "RC",
|
||||||
},
|
},
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
cmd.CheckArgs(0, 1, command, args)
|
cmd.CheckArgs(0, 1, command, args)
|
||||||
if rc.Opt.Enabled {
|
if rc.Opt.Enabled {
|
||||||
fs.Fatalf(nil, "Don't supply --rc flag when using rcd")
|
fs.Fatalf(nil, "Don't supply --rc flag when using rcd")
|
||||||
@@ -49,6 +52,12 @@ See the [rc documentation](/rc/) for more info on the rc flags.
|
|||||||
rc.Opt.Files = args[0]
|
rc.Opt.Files = args[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start the cluster worker if configured
|
||||||
|
_, err := cluster.NewWorker(ctx)
|
||||||
|
if err != nil {
|
||||||
|
fs.Fatalf(nil, "Failed to start cluster worker: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
s, err := rcserver.Start(context.Background(), &rc.Opt)
|
s, err := rcserver.Start(context.Background(), &rc.Opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Fatalf(nil, "Failed to start remote control: %v", err)
|
fs.Fatalf(nil, "Failed to start remote control: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user