Module: Cognizant::Process::Attributes

Included in:
Cognizant::Process
Defined in:
lib/cognizant/process/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#autostarttrue, false

Whether or not to auto start the process when beginning monitoring. Afterwards, auto start is automatically managed based on user initiated stop or restart requests. Note: For child processes, this value is automatically set to false.

Returns:

  • (true, false)

    Defaults to true


26
27
28
# File 'lib/cognizant/process/attributes.rb', line 26

def autostart
  @autostart
end

#chdirString

The current working directory for the process to start with.

Returns:

  • (String)

    Defaults to nil


62
63
64
# File 'lib/cognizant/process/attributes.rb', line 62

def chdir
  @chdir
end

#chrootString

The chroot directory to change the process' idea of the file system root.

Returns:

  • (String)

    Defaults to nil


58
59
60
# File 'lib/cognizant/process/attributes.rb', line 58

def chroot
  @chroot
end

#daemonizetrue, false

Whether or not to daemonize the process. It is recommended that cognizant managed your process completely by process not daemonizing itself. Find a non-daemonizing option in your process' documentation.

Returns:

  • (true, false)

    Defaults to true


19
20
21
# File 'lib/cognizant/process/attributes.rb', line 19

def daemonize
  @daemonize
end

#envHash

Environment variables for process.

Returns:

  • (Hash)

    Defaults to {}


53
54
55
# File 'lib/cognizant/process/attributes.rb', line 53

def env
  @env
end

#errfileString

The file to log the daemon's STDERR stream into.

Returns:

  • (String)

    Defaults to value of logfile


49
50
51
# File 'lib/cognizant/process/attributes.rb', line 49

def errfile
  @errfile
end

#gidString

Run the process as the given user group. e.g. “deploy”

Returns:

  • (String)

    Defaults to nil


77
78
79
# File 'lib/cognizant/process/attributes.rb', line 77

def gid
  @gid
end

#groupString

Group classification for the process. Note: This is not system process group. See `gid` attribute instead.

Returns:

  • (String)

    Defaults to nil


12
13
14
# File 'lib/cognizant/process/attributes.rb', line 12

def group
  @group
end

#groupsArray

Supplementary user groups for the process. e.g. [“staff”]

Returns:

  • (Array)

    Defaults to []


82
83
84
# File 'lib/cognizant/process/attributes.rb', line 82

def groups
  @groups
end

#logfileString

The file to log the process' STDOUT stream into.

Returns:

  • (String)

    Defaults to value of logs_dir/name.log


45
46
47
# File 'lib/cognizant/process/attributes.rb', line 45

def logfile
  @logfile
end

#nameString

Unique name for the process. Note: For child processes, this value is set automatically.

Returns:

  • (String)

7
8
9
# File 'lib/cognizant/process/attributes.rb', line 7

def name
  @name
end

#pid_commandString

The command that returns the pid of the process.

Returns:

  • (String)

    Defaults to nil


36
37
38
# File 'lib/cognizant/process/attributes.rb', line 36

def pid_command
  @pid_command
end

#pidfileString

The pid lock file for the process. Required when daemonize is set to false.

Returns:

  • (String)

    Defaults to value of pids_dir/name.pid


41
42
43
# File 'lib/cognizant/process/attributes.rb', line 41

def pidfile
  @pidfile
end

#ping_commandString

The command to check the running status of the process with. The exit status of the command is used to determine the status. e.g. “/usr/bin/redis-cli PING”

Returns:

  • (String)

    Defaults to nil


32
33
34
# File 'lib/cognizant/process/attributes.rb', line 32

def ping_command
  @ping_command
end

#uidString

Run the process as the given user. e.g. “deploy”, 1000

Returns:

  • (String)

    Defaults to nil


72
73
74
# File 'lib/cognizant/process/attributes.rb', line 72

def uid
  @uid
end

#umaskInteger

Limit the permission modes for files and directories created by the process.

Returns:

  • (Integer)

    Defaults to nil


67
68
69
# File 'lib/cognizant/process/attributes.rb', line 67

def umask
  @umask
end

Instance Method Details

#autostart!Object


88
89
90
# File 'lib/cognizant/process/attributes.rb', line 88

def autostart!
  @autostart = true
end

#daemonize!Object


84
85
86
# File 'lib/cognizant/process/attributes.rb', line 84

def daemonize!
  @daemonize = true
end

#reset_attributes!Object


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/cognizant/process/attributes.rb', line 93

def reset_attributes!
  self.name = nil
  self.group = nil
  self.daemonize = true
  self.autostart = false
  self.ping_command = nil
  self.pid_command = nil
  self.pidfile = nil
  self.logfile = nil
  self.errfile = nil
  self.env = {}
  self.chroot = nil
  self.chdir = nil
  self.uid = nil
  self.gid = nil
  self.groups = []
end