`status` can take several parameters or none.
parent
7f9bd275b1
commit
75d5fd7874
|
@ -129,7 +129,8 @@ begin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif args[0] == "status"
|
elsif args[0] == "status"
|
||||||
child = Process.run "#{OWN_LIBEXEC_DIR}/status", [args[1]],
|
args.shift
|
||||||
|
child = Process.run "#{OWN_LIBEXEC_DIR}/status", args,
|
||||||
output: Process::Redirect::Inherit,
|
output: Process::Redirect::Inherit,
|
||||||
error: Process::Redirect::Inherit
|
error: Process::Redirect::Inherit
|
||||||
return_value = (child.exit_status / 256).to_i
|
return_value = (child.exit_status / 256).to_i
|
||||||
|
|
|
@ -10,10 +10,33 @@ Service.load RC_DIRECTORY
|
||||||
LibC.setuid 0
|
LibC.setuid 0
|
||||||
LibC.setgid 0
|
LibC.setgid 0
|
||||||
|
|
||||||
Service.get_by_id(ARGV[0]).try do |service|
|
services = ARGV
|
||||||
puts service.status PID_DIRECTORY
|
if services.size == 0
|
||||||
exit 0
|
services = Service.all
|
||||||
|
else
|
||||||
|
services = services.map do |id|
|
||||||
|
Service.get_by_id id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
exit 1
|
if services.size == 1
|
||||||
|
services[0]?.try do |service|
|
||||||
|
puts service.status PID_DIRECTORY
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
service_not_found = false
|
||||||
|
|
||||||
|
services.each do |service|
|
||||||
|
if service.nil?
|
||||||
|
service_not_found = true
|
||||||
|
else
|
||||||
|
puts "#{service.id}: #{service.status PID_DIRECTORY}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
exit 1 if service_not_found
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue