Grooming.
- Service#running?(pid_dir) added. - No attempt to stop services not running is being made by `stop` anymore.
This commit is contained in:
parent
e331828c8b
commit
9a93937176
21
src/main.cr
21
src/main.cr
@ -291,6 +291,9 @@ class Service
|
||||
Status::Stopped
|
||||
end
|
||||
end
|
||||
def running?(pid_dir)
|
||||
status(pid_dir) == Service::Status::Running
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{name} (in #{@environment.name})"
|
||||
@ -445,9 +448,7 @@ begin
|
||||
|
||||
services.each do |service|
|
||||
service.dependency_tree.flatten.reverse.each do |service|
|
||||
if service.status(PID_DIRECTORY) == Service::Status::Running
|
||||
next
|
||||
end
|
||||
next if service.running? PID_DIRECTORY
|
||||
|
||||
puts "starting #{service.to_s}"
|
||||
service.start PID_DIRECTORY, LOG_DIRECTORY
|
||||
@ -466,14 +467,14 @@ begin
|
||||
|
||||
services.each do |service|
|
||||
# FIXME: Build revdep tree and stop services started as dependencies?
|
||||
if service.status(PID_DIRECTORY) == Service::Status::Running
|
||||
# FIXME: Should we remove duplicate services from the
|
||||
# tree once flattened?
|
||||
service.reverse_dependency_tree.flatten.reverse.each do |service|
|
||||
next if ! service.running? PID_DIRECTORY
|
||||
# FIXME: Should we remove duplicate services from the
|
||||
# tree once flattened?
|
||||
service.reverse_dependency_tree.flatten.reverse.each do |service|
|
||||
next if ! service.running? PID_DIRECTORY
|
||||
|
||||
puts "stopping #{service.to_s}"
|
||||
service.stop PID_DIRECTORY
|
||||
end
|
||||
puts "stopping #{service.to_s}"
|
||||
service.stop PID_DIRECTORY
|
||||
end
|
||||
end
|
||||
elsif args[0] == "status"
|
||||
|
Loading…
Reference in New Issue
Block a user