summaryrefslogtreecommitdiff
path: root/mode-watch.lua
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2013-09-17 17:31:28 (GMT)
committerChristian Pointner <equinox@helsinki.at>2013-09-17 17:31:28 (GMT)
commit3435b6a2237f0386c0d41c9e6e24d78b63070ef0 (patch)
treef05d5b5d9e7b09da09f76ec09d6a88474dde71d1 /mode-watch.lua
parent57ce536f59698a376c938b74c25e951f3d01836c (diff)
moved mail sending function to own module
Diffstat (limited to 'mode-watch.lua')
-rw-r--r--mode-watch.lua16
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