Sha256: 4d4b9a44fc6d40e008b9030a34ba4d282625aec642031b53d28b468f9737fb1e

Contents?: true

Size: 838 Bytes

Versions: 35

Compression:

Stored size: 838 Bytes

Contents

#!/usr/bin/env ruby

require 'forever'
require 'fileutils'

CMD="dyn-4ever"
SRVS=["dyn-srv","dyn-html","dyn-http"]
DYN4EVER_DIR=File.join(ENV["HOME"],"dyndoc","dyn-4ever")
FileUtils.mkdir_p DYN4EVER_DIR

Forever.run do
  dir DYN4EVER_DIR
  every 10.seconds do
    status=SRVS.map do |srv|
      `#{srv} status`.empty?
    end
    if status.any?
      message="at #{Time.now}: " + status.each_with_index.map { |e,i|  e ? SRVS[i] : nil}.compact.join("+") + " stopped and restarted!"
      if RUBY_PLATFORM =~ /darwin/
        ##p lint_error
        cmd_to_display="display notification \"#{message}\" with title \"dyn status\""
        `osascript -e '#{cmd_to_display}'`
      end
      puts message
      status.each_with_index { |e,i|  `#{SRVS[i]} start` if e }
    end
  end
  after :all do
    SRVS.each {|srv| `#{srv} stop`}
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
dyndoc-ruby-1.5.0 bin/dyn-4ever
dyndoc-ruby-1.4.7 bin/dyn-4ever
dyndoc-ruby-1.4.6 bin/dyn-4ever
dyndoc-ruby-1.4.5 bin/dyn-4ever
dyndoc-ruby-1.4.2 bin/dyn-4ever
dyndoc-ruby-1.4.1 bin/dyn-4ever
dyndoc-ruby-1.4.0 bin/dyn-4ever
dyndoc-ruby-1.3.9 bin/dyn-4ever
dyndoc-ruby-1.3.6 bin/dyn-4ever
dyndoc-ruby-1.3.4 bin/dyn-4ever
dyndoc-ruby-1.3.2 bin/dyn-4ever
dyndoc-ruby-1.3.0 bin/dyn-4ever
dyndoc-ruby-1.2.2 bin/dyn-4ever
dyndoc-ruby-1.2.1 bin/dyn-4ever
dyndoc-ruby-1.2.0 bin/dyn-4ever
dyndoc-ruby-1.0.25 bin/dyn-4ever
dyndoc-ruby-1.0.24 bin/dyn-4ever
dyndoc-ruby-1.0.23 bin/dyn-4ever
dyndoc-ruby-1.0.22 bin/dyn-4ever
dyndoc-ruby-1.0.21 bin/dyn-4ever