Skip to content

Instantly share code, notes, and snippets.

@quantenProjects
Created March 14, 2016 17:54
simple server status check for https://github.com/hangoutsbot/hangoutsbot don't forget to activate the plugin in the config
"""
execute w and df -h on server
"""
import plugins
import subprocess
def _initialize(bot):
plugins.register_admin_command(['w'])
plugins.register_admin_command(['df'])
def w(bot, event, *args):
string = subprocess.Popen(["w"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").replace("\n","<br><br>")
yield from bot.coro_send_message(event.conv_id, string)
def df(bot, event, *args):
string = subprocess.Popen(["df","-h"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").replace("\n","<br><br>")
yield from bot.coro_send_message(event.conv_id, string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment