Class: Stemcell::LogTailer
- Inherits:
-
Object
- Object
- Stemcell::LogTailer
- Defined in:
- lib/stemcell/log_tailer.rb
Constant Summary collapse
- MAX_WAIT_FOR_SSH =
Don’t wait more than two minutes
120
- TAILING_COMMAND =
"while [ ! -s /var/log/init ]; " \ "do " \ "printf '.' 1>&2; " \ "sleep 1; " \ "done; " \ "echo ' /var/log/init exists!' 1>&2; " \ "exec tail -qf /var/log/init*"
Instance Attribute Summary collapse
-
#finished ⇒ Object
readonly
Returns the value of attribute finished.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#interrupted ⇒ Object
readonly
Returns the value of attribute interrupted.
-
#ssh_port ⇒ Object
readonly
Returns the value of attribute ssh_port.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(hostname, username, ssh_port = 22) ⇒ LogTailer
constructor
A new instance of LogTailer.
- #run! ⇒ Object
Constructor Details
#initialize(hostname, username, ssh_port = 22) ⇒ LogTailer
Returns a new instance of LogTailer.
25 26 27 28 29 30 31 32 |
# File 'lib/stemcell/log_tailer.rb', line 25 def initialize(hostname, username, ssh_port=22) @hostname = hostname @username = username @ssh_port = ssh_port @finished = false @interrupted = false end |
Instance Attribute Details
#finished ⇒ Object (readonly)
Returns the value of attribute finished.
10 11 12 |
# File 'lib/stemcell/log_tailer.rb', line 10 def finished @finished end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
6 7 8 |
# File 'lib/stemcell/log_tailer.rb', line 6 def hostname @hostname end |
#interrupted ⇒ Object (readonly)
Returns the value of attribute interrupted.
11 12 13 |
# File 'lib/stemcell/log_tailer.rb', line 11 def interrupted @interrupted end |
#ssh_port ⇒ Object (readonly)
Returns the value of attribute ssh_port.
8 9 10 |
# File 'lib/stemcell/log_tailer.rb', line 8 def ssh_port @ssh_port end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/stemcell/log_tailer.rb', line 7 def username @username end |
Instance Method Details
#run! ⇒ Object
34 35 36 37 38 39 |
# File 'lib/stemcell/log_tailer.rb', line 34 def run! while_catching_interrupt do return unless wait_for_ssh tail_until_interrupt end end |