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