Skip to content

Instantly share code, notes, and snippets.

@MaherSaif
Created July 23, 2009 20:45
Show Gist options
  • Save MaherSaif/153564 to your computer and use it in GitHub Desktop.
Save MaherSaif/153564 to your computer and use it in GitHub Desktop.
module Communicator
class Command
def initialize(cmd)
@cmd = cmd
end
def execute(params = [])
`#{@cmd} #{params.join(' ')}`
end
end
class Service
def initialize(service_name)
@service_name = service_name
end
def start()
`service #{@service_name} start`
end
def stop()
`service #{@service_name} stop`
end
def reload()
stop()
sleep(1)
start()
end
def status()
`service #{@service_name} status`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment