fix frps service init
This commit is contained in:
parent
3cb1dddb45
commit
cd0959bba0
@ -97,7 +97,17 @@ var rootCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
if !service.Interactive() {
|
||||
if err := srvCmd.Execute(); err != nil {
|
||||
var err error
|
||||
srv, err = service.New(&serviceFRP{}, &service.Config{
|
||||
Name: srvName,
|
||||
DisplayName: srvDName,
|
||||
Description: srvDesc,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = srv.Run(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -38,12 +38,6 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVar(&srvDName, "display_name", "frps", "Service display name")
|
||||
rootCmd.PersistentFlags().StringVar(&srvDesc, "description", "frps service", "Service description")
|
||||
|
||||
if !service.Interactive() {
|
||||
srvCmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return srv.Run()
|
||||
}
|
||||
}
|
||||
|
||||
srvCmd.AddCommand(installSrvCmd, uninstallSrvCmd, startSrvCmd, stopSrvCmd, restartSrvCmd)
|
||||
rootCmd.AddCommand(srvCmd)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user