kewlhotrod

Untitled

Jul 1st, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. var sys = require('sys');
  2. var exec = require('child_process').exec;
  3. var path = Math.floor(Math.random()*101);
  4.  
  5. var fs = require('fs');
  6.  
  7. fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
  8. if (err) {
  9. return console.log(err);
  10. }
  11. console.log(data.toString());
  12. var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="' + path + '"');
  13.  
  14. fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
  15. if (err) return console.log(err);
  16. function puts(error, stdout, stderr) { sys.puts(stdout) }
  17. exec("bash /home/shoutcast/mkdir.sh", puts);
  18. });
  19.  
  20. fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
  21. if (err) return console.log(err);
  22. });
  23.  
  24.  
  25. });
Advertisement
Add Comment
Please, Sign In to add comment