diff options
Diffstat (limited to 'mode-watch.lua')
-rw-r--r-- | mode-watch.lua | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/mode-watch.lua b/mode-watch.lua index 7f1e745..b603661 100644 --- a/mode-watch.lua +++ b/mode-watch.lua @@ -20,6 +20,7 @@ -- socket = require("socket") +utils = require("utils") function set_master_led() os.execute("/sbin/led.sh set master") @@ -36,17 +37,6 @@ function clear_leds() os.execute("/sbin/led.sh clear standby") end -function send_mail(address, subject, bodytext) - local fp = assert(io.popen("/usr/sbin/mini_sendmail -smailrelay -fnoreply@helsinki.at " .. address, "w")) - - fp:write("Subject: " .. subject .. "\n") - fp:write("To: " .. address .. "\n") - fp:write("\n") - fp:write(bodytext) - fp:write("\n") - fp:close() -end - current_mode = nil function process_cmd(message) @@ -73,10 +63,10 @@ function process_cmd(message) if(new_mode and new_mode ~= current_mode) then log.printf(log.NOTICE, "mode is now " .. new_mode) if(current_mode == nil) then - send_mail("logs@helsinki.at", "[RHCTL] (re)started mode is now " .. new_mode, + utils.send_mail("logs@helsinki.at", "[RHCTL] (re)started mode is now " .. new_mode, "RHCTL just (re)started current mode is " .. new_mode) else - send_mail("logs@helsinki.at", "[RHCTL] mode changed to " .. new_mode, + utils.send_mail("logs@helsinki.at", "[RHCTL] mode changed to " .. new_mode, "RHCTL just switched from " .. current_mode .. " to " .. new_mode) end current_mode = new_mode |