diff --git a/README.md b/README.md
index 66e072040..8fdd12fbd 100644
--- a/README.md
+++ b/README.md
@@ -188,7 +188,7 @@ Download the latest binary from the [Releases page](https://github.com/dagu-dev/
### 1. Launch the Web UI
-Start the server with the command `dagu server` and browse to `http://127.0.0.1:8080` to explore the Web UI.
+Start the server and scheduler with the command `dagu start-all` and browse to `http://127.0.0.1:8080` to explore the Web UI.
### 2. Create a New DAG
@@ -236,11 +236,14 @@ dagu restart
# Dry-runs the DAG
dagu dry [--params=]
+# Launches both the web UI server and scheduler process
+dagu start-all [--host=] [--port=] [==dags=]
+
# Launches the Dagu web UI server
-dagu server
+dagu server [--host=] [--port=] [==dags=]
# Starts the scheduler process
-dagu scheduler
+dagu scheduler [==dags=]
# Shows the current binary version
dagu version
diff --git a/cmd/root.go b/cmd/root.go
index d4ef876da..4ce2fc1e4 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -86,4 +86,5 @@ func registerCommands(root *cobra.Command) {
rootCmd.AddCommand(serverCmd())
rootCmd.AddCommand(createSchedulerCommand())
rootCmd.AddCommand(retryCmd())
+ rootCmd.AddCommand(startAllCmd())
}
diff --git a/cmd/scheduler.go b/cmd/scheduler.go
index 1440f8c8c..443934f81 100644
--- a/cmd/scheduler.go
+++ b/cmd/scheduler.go
@@ -14,7 +14,6 @@ func createSchedulerCommand() *cobra.Command {
Short: "Start the scheduler",
Long: `dagu scheduler [--dags=]`,
Run: func(cmd *cobra.Command, args []string) {
- // TODO: fixme
config.Get().DAGs = getFlagString(cmd, "dags", config.Get().DAGs)
err := core.NewScheduler(app.TopLevelModule).Start(cmd.Context())
diff --git a/cmd/start_all.go b/cmd/start_all.go
new file mode 100644
index 000000000..dd0378063
--- /dev/null
+++ b/cmd/start_all.go
@@ -0,0 +1,46 @@
+package cmd
+
+import (
+ "log"
+
+ "github.com/dagu-dev/dagu/app"
+ "github.com/dagu-dev/dagu/internal/config"
+ "github.com/dagu-dev/dagu/service/core"
+ "github.com/spf13/cobra"
+ "github.com/spf13/viper"
+)
+
+func startAllCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "start-all",
+ Short: "Launches both the Dagu web UI server and the scheduler process.",
+ Long: `dagu start-all [--dags=] [--host=] [--port=]`,
+ Run: func(cmd *cobra.Command, args []string) {
+ ctx := cmd.Context()
+
+ go func() {
+ config.Get().DAGs = getFlagString(cmd, "dags", config.Get().DAGs)
+ err := core.NewScheduler(app.TopLevelModule).Start(cmd.Context())
+ if err != nil {
+ log.Fatal(err)
+ }
+ }()
+
+ service := app.NewFrontendService()
+ err := service.Start(ctx)
+ checkError(err)
+ },
+ }
+ bindStartAllCommandFlags(cmd)
+ return cmd
+}
+
+func bindStartAllCommandFlags(cmd *cobra.Command) {
+ cmd.Flags().StringP("dags", "d", "", "location of DAG files (default is $HOME/.dagu/dags)")
+ cmd.Flags().StringP("host", "s", "", "server host (default is localhost)")
+ cmd.Flags().StringP("port", "p", "", "server port (default is 8080)")
+
+ _ = viper.BindPFlag("port", cmd.Flags().Lookup("port"))
+ _ = viper.BindPFlag("host", cmd.Flags().Lookup("host"))
+ _ = viper.BindPFlag("dags", cmd.Flags().Lookup("dags"))
+}
diff --git a/docs/source/cli.rst b/docs/source/cli.rst
index 01b8e177a..4574b3aa5 100644
--- a/docs/source/cli.rst
+++ b/docs/source/cli.rst
@@ -3,12 +3,34 @@ Command Line Interface
The following commands are available for interacting with Dagu:
-- ``dagu start [--params=] ``: Runs the DAG.
-- ``dagu status ``: Displays the current status of the DAG.
-- ``dagu retry --req= ``: Re-runs the specified DAG run.
-- ``dagu stop ``: Stops the DAG execution by sending TERM signals.
-- ``dagu restart ``: Restarts the current running DAG.
-- ``dagu dry [--params=] ``: Dry-runs the DAG.
-- ``dagu server``: Launches the Dagu web UI server.
-- ``dagu scheduler``: Starts the scheduler process.
-- ``dagu version``: Shows the current binary version.
+.. code-block:: sh
+
+ # Runs the DAG
+ dagu start [--params=]
+
+ # Displays the current status of the DAG
+ dagu status
+
+ # Re-runs the specified DAG run
+ dagu retry --req=
+
+ # Stops the DAG execution
+ dagu stop
+
+ # Restarts the current running DAG
+ dagu restart
+
+ # Dry-runs the DAG
+ dagu dry [--params=]
+
+ # Launches both the web UI server and scheduler process
+ dagu start-all [--host=] [--port=] [==dags=]
+
+ # Launches the Dagu web UI server
+ dagu server [--host=] [--port=] [==dags=]
+
+ # Starts the scheduler process
+ dagu scheduler [==dags=]
+
+ # Shows the current binary version
+ dagu version
\ No newline at end of file