package cmd

import (
	"github.com/spf13/cobra"
)

var daemonStopCmd = &cobra.Command{
	Use:   "stop",
	Short: "Stop a daemon",
	Long:  "",
	RunE: func(cmd *cobra.Command, args []string) error {
		_, err := restClient.R().Post("/api/v1/stop")
		return err
	},
}

func init() {
	daemon.AddCommand(daemonStopCmd)
}

package cmd

import (
	"syscall"

	"github.com/spf13/cobra"
)

var daemonStopCmd = &cobra.Command{
	Use:   "stop",
	Short: "Stop a daemon",
	Long:  "",
	RunE: func(cmd *cobra.Command, args []string) error {

		syscall.Kill(syscall.Getpid(), syscall.SIGTERM)

		return nil
	},
}

func init() {
	daemon.AddCommand()
}

--- 
+++ 
@@ -1,8 +1,6 @@
 package cmd
 
 import (
-	"syscall"
-
 	"github.com/spf13/cobra"
 )
 
@@ -11,13 +9,11 @@
 	Short: "Stop a daemon",
 	Long:  "",
 	RunE: func(cmd *cobra.Command, args []string) error {
-
-		syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
-
-		return nil
+		_, err := restClient.R().Post("/api/v1/stop")
+		return err
 	},
 }
 
 func init() {
-	daemon.AddCommand()
+	daemon.AddCommand(daemonStopCmd)
 }
Add command to stop the daemon
