Module: Rinit
- Extended by:
- ProcessUtils
- Defined in:
- lib/rinit.rb,
lib/rinit/version.rb,
lib/rinit/commands.rb,
lib/rinit/exceptions.rb,
lib/rinit/process_utils.rb,
lib/rinit/template_builder.rb
Defined Under Namespace
Modules: ProcessUtils Classes: CommandException, ProcessException, TemplateBuilder
Constant Summary collapse
- VERSION =
"0.1.5"
Class Method Summary collapse
- .restart(pidfile, opts = {}) ⇒ Object
- .start(opts = {}) ⇒ nil
- .status(pidfile) ⇒ Object
-
.stop(pidfile) ⇒ nil
If there were not any errors.
Methods included from ProcessUtils
get_pid_from_file, is_process_running?, kill_process, may_the_fork_be_with_you, pidfile_cleanup, write_pidfile
Class Method Details
.restart(pidfile, opts = {}) ⇒ Object
36 37 38 39 |
# File 'lib/rinit/commands.rb', line 36 def restart(pidfile, opts={}) stop(pidfile) start(opts) end |
.start(opts = {}) ⇒ nil
11 12 13 14 15 16 |
# File 'lib/rinit/commands.rb', line 11 def start(opts={}) command = opts.fetch(:cmd) { raise Rinit::CommandException.new "No command given" } user = opts.fetch(:chuid) { raise Rinit::CommandException.new "No user given" } pidfile = opts.fetch(:pidfile) { raise Rinit::CommandException.new "No pidfile was given" } may_the_fork_be_with_you(command, pidfile) end |
.status(pidfile) ⇒ Object
27 28 29 |
# File 'lib/rinit/commands.rb', line 27 def status pidfile is_process_running?(pidfile) end |
.stop(pidfile) ⇒ nil
Returns if there were not any errors.
20 21 22 23 |
# File 'lib/rinit/commands.rb', line 20 def stop(pidfile) kill_process(pidfile) pidfile_cleanup(pidfile) end |