var fs   = require("fs"), path = require("path")
var args = process.argv.splice(2);
var tmplfile = path.join(args[3],"server.xml.temple");
var outfile  = path.join(args[3],"server.xml");
//console.log(tmplfile + "," + outfile);
var content = fs.readFileSync(tmplfile).toString();
content = content.replace(/\${workdir}/, args[0]);
content = content.replace(/\${nodebin}/, args[1]);
content = content.replace(/\${appmain}/, args[2]);
fs.writeFileSync(outfile, content);