Class: Termworld::Commands::DaemonOperator
- Inherits:
-
Object
- Object
- Termworld::Commands::DaemonOperator
- Defined in:
- lib/termworld/commands/daemon_operator.rb
Class Method Summary collapse
Class Method Details
.start ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/termworld/commands/daemon_operator.rb', line 5 def start credential = Credential.new return puts credential. unless credential.logged_in? daemon = Daemon.new(:start) return puts daemon. if daemon. daemon.prepare puts Utils::Color.greenen "Started!" daemon.run loop do break unless daemon.alive? sleep 1 end daemon.stop end |
.status ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/termworld/commands/daemon_operator.rb', line 36 def status credential = Credential.new return puts credential. unless credential.logged_in? daemon = Daemon.new(:status) return puts daemon. if daemon. if daemon.alive? puts Utils::Color.bluen "Running!" else puts Utils::Color.bluen "Not running." end end |
.stop ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/termworld/commands/daemon_operator.rb', line 21 def stop credential = Credential.new daemon = Daemon.new(:stop) unless credential.logged_in? daemon.stop return puts credential. end if daemon. daemon.delete_files return puts daemon. end daemon.stop puts Utils::Color.greenen "Stopped!" end |