Class: DJB::Service
- Inherits:
-
Object
show all
- Defined in:
- lib/djb.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(root, svc = "/command/svc") ⇒ Service
Returns a new instance of Service.
17
18
19
|
# File 'lib/djb.rb', line 17
def initialize(root, svc="/command/svc")
@root, @svc = root, svc
end
|
Instance Attribute Details
#root ⇒ Object
Returns the value of attribute root.
15
16
17
|
# File 'lib/djb.rb', line 15
def root
@root
end
|
#svc ⇒ Object
Returns the value of attribute svc.
16
17
18
|
# File 'lib/djb.rb', line 16
def svc
@svc
end
|
Instance Method Details
#alarm ⇒ Object
81
82
83
|
# File 'lib/djb.rb', line 81
def alarm
_svc('-a')
end
|
#continue ⇒ Object
73
74
75
|
# File 'lib/djb.rb', line 73
def continue
_svc('-c')
end
|
#down ⇒ Object
61
62
63
|
# File 'lib/djb.rb', line 61
def down
_svc('-d')
end
|
#env(name, *args) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/djb.rb', line 23
def env(name, *args)
fn = "#{@root}/env/#{name}"
if args.size == 0
return File.open(fn).read()
else
File.write(fn, args.join(""))
end
end
|
#exit ⇒ Object
97
98
99
|
# File 'lib/djb.rb', line 97
def exit
_svc('-x')
end
|
#hangup ⇒ Object
77
78
79
|
# File 'lib/djb.rb', line 77
def hangup
_svc('-h')
end
|
#interrupt ⇒ Object
85
86
87
|
# File 'lib/djb.rb', line 85
def interrupt
_svc('-i')
end
|
#kill ⇒ Object
93
94
95
|
# File 'lib/djb.rb', line 93
def kill
_svc('-k')
end
|
#make ⇒ Object
Implemented in the base class. def fn() end
35
36
37
38
39
|
# File 'lib/djb.rb', line 35
def make
Dir.chdir(File.dirname(fn())) do |d|
system("make")
end
end
|
#once ⇒ Object
65
66
67
|
# File 'lib/djb.rb', line 65
def once
_svc('-o')
end
|
#pause ⇒ Object
69
70
71
|
# File 'lib/djb.rb', line 69
def pause
_svc('-p')
end
|
#restart ⇒ Object
43
44
45
|
# File 'lib/djb.rb', line 43
def restart
terminate()
end
|
#start ⇒ Object
47
48
49
|
# File 'lib/djb.rb', line 47
def start
up()
end
|
#stop ⇒ Object
51
52
53
|
# File 'lib/djb.rb', line 51
def stop
down()
end
|
#terminate ⇒ Object
89
90
91
|
# File 'lib/djb.rb', line 89
def terminate
_svc('-t')
end
|
#up ⇒ Object
57
58
59
|
# File 'lib/djb.rb', line 57
def up
_svc('-u')
end
|