Last active
August 29, 2015 14:06
-
-
Save meaku/f2e5fc688ed9059d4ebe to your computer and use it in GitHub Desktop.
autoresponder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
"use strict"; | |
console.log("checking for auto responses"); | |
var fs = require("fs"), | |
exec = require("child_process").exec; | |
var input = ""; | |
process.stdin.on("data", function (chunk) { | |
input += chunk; | |
}); | |
process.stdin.on("end", function () { | |
console.log("input", input); | |
var cmd = 'qmail-autoresponder autoresponders/autotest/ <<< "' + input + '"'; | |
fs.writeFileSync(__dirname + "/qmail-log.txt", cmd); | |
//autorespond.js / < qmail-test.txt | |
var child = exec(cmd, function (err, stdout, stderr) { | |
console.log("done", arguments); | |
process.exit(0); | |
}); | |
}) | |
//0.8 hack | |
process.stdin.resume() | |
//kill after 5 seconds if not done | |
setTimeout(function () { | |
process.exit(0); | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment