Skip to content

Instantly share code, notes, and snippets.

@supki
Last active December 15, 2015 22:19
Show Gist options
  • Save supki/5332060 to your computer and use it in GitHub Desktop.
Save supki/5332060 to your computer and use it in GitHub Desktop.
M
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
vpn_name = "pemi"
Object.send :define_method, :status do |&block|
if system "/etc/init.d/openvpn.#{vpn_name} status > /dev/null"
block[:green, "OK"]
else
block[:red, "NOT pemised"]
end
end
puts status { |color, what| "<fc=#{color}>#{what}</fc>" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment