github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/service/upstart/service.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package upstart 5 6 import ( 7 "fmt" 8 "path" 9 10 "github.com/juju/utils" 11 12 "github.com/juju/juju/service/common" 13 ) 14 15 const ( 16 maxAgentFiles = 20000 17 ) 18 19 // MachineAgentUpstartService returns the upstart config for a machine agent 20 // based on the tag and machineId passed in. 21 func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId string, env map[string]string) *Service { 22 logFile := path.Join(logDir, tag+".log") 23 // The machine agent always starts with debug turned on. The logger worker 24 // will update this to the system logging environment as soon as it starts. 25 conf := common.Conf{ 26 Desc: fmt.Sprintf("juju %s agent", tag), 27 Limit: map[string]string{ 28 "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles), 29 }, 30 Cmd: path.Join(toolsDir, "jujud") + 31 " machine" + 32 " --data-dir " + utils.ShQuote(dataDir) + 33 " --machine-id " + machineId + 34 " --debug", 35 Out: logFile, 36 Env: env, 37 } 38 svc := NewService(name, conf) 39 return svc 40 }