summaryrefslogtreecommitdiffstats
path: root/cmd/commands/jobserver.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-05-17 12:40:40 -0700
committerGitHub <noreply@github.com>2018-05-17 12:40:40 -0700
commit11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch)
tree0eceb950872c7234348f0b41d4492073908840d0 /cmd/commands/jobserver.go
parent1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff)
downloadchat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz
chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2
chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/commands/jobserver.go')
-rw-r--r--cmd/commands/jobserver.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/cmd/commands/jobserver.go b/cmd/commands/jobserver.go
deleted file mode 100644
index a7671e190..000000000
--- a/cmd/commands/jobserver.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package commands
-
-import (
- "os"
- "os/signal"
- "syscall"
-
- "github.com/mattermost/mattermost-server/cmd"
- "github.com/mattermost/mattermost-server/mlog"
- "github.com/spf13/cobra"
-)
-
-var JobserverCmd = &cobra.Command{
- Use: "jobserver",
- Short: "Start the Mattermost job server",
- Run: jobserverCmdF,
-}
-
-func init() {
- JobserverCmd.Flags().Bool("nojobs", false, "Do not run jobs on this jobserver.")
- JobserverCmd.Flags().Bool("noschedule", false, "Do not schedule jobs from this jobserver.")
-
- cmd.RootCmd.AddCommand(JobserverCmd)
-}
-
-func jobserverCmdF(command *cobra.Command, args []string) {
- // Options
- noJobs, _ := command.Flags().GetBool("nojobs")
- noSchedule, _ := command.Flags().GetBool("noschedule")
-
- // Initialize
- a, err := cmd.InitDBCommandContext("config.json")
- if err != nil {
- panic(err.Error())
- }
- defer a.Shutdown()
-
- a.LoadLicense()
-
- // Run jobs
- mlog.Info("Starting Mattermost job server")
- if !noJobs {
- a.Jobs.StartWorkers()
- }
- if !noSchedule {
- a.Jobs.StartSchedulers()
- }
-
- signalChan := make(chan os.Signal, 1)
- signal.Notify(signalChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
- <-signalChan
-
- // Cleanup anything that isn't handled by a defer statement
- mlog.Info("Stopping Mattermost job server")
-
- a.Jobs.StopSchedulers()
- a.Jobs.StopWorkers()
-
- mlog.Info("Stopped Mattermost job server")
-}