mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-26 09:30:28 +00:00
81c8e8d898
profiling is now available via the HTTP base URL /debug/pprof/ examples, use this URL to start and download a 30 seconds CPU profile: /debug/pprof/profile?seconds=30 use this URL to profile used memory: /debug/pprof/heap?gc=1 use this URL to profile allocated memory: /debug/pprof/allocs?gc=1 Full docs here: https://golang.org/pkg/net/http/pprof/
41 lines
960 B
Go
41 lines
960 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/drakkan/sftpgo/service"
|
|
"github.com/drakkan/sftpgo/utils"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
serveCmd = &cobra.Command{
|
|
Use: "serve",
|
|
Short: "Start the SFTP Server",
|
|
Long: `To start the SFTPGo with the default values for the command line flags simply use:
|
|
|
|
sftpgo serve
|
|
|
|
Please take a look at the usage below to customize the startup options`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
service := service.Service{
|
|
ConfigDir: utils.CleanDirInput(configDir),
|
|
ConfigFile: configFile,
|
|
LogFilePath: logFilePath,
|
|
LogMaxSize: logMaxSize,
|
|
LogMaxBackups: logMaxBackups,
|
|
LogMaxAge: logMaxAge,
|
|
LogCompress: logCompress,
|
|
LogVerbose: logVerbose,
|
|
Profiler: profiler,
|
|
Shutdown: make(chan bool),
|
|
}
|
|
if err := service.Start(); err == nil {
|
|
service.Wait()
|
|
}
|
|
},
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(serveCmd)
|
|
addServeFlags(serveCmd)
|
|
}
|