kewlhotrod

Untitled

Jul 1st, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 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. fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
  7. if (err) {
  8. return console.log(err);
  9. }
  10. console.log(data.toString('utf8'));
  11. var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="YES"');
  12.  
  13. fs.writeFile('/home/shoutcast/mkdir.sh', result, 'utf8', function (err) {
  14. if (err) return console.log(err);
  15. });
  16. });
  17.  
  18. function puts(error, stdout, stderr) { sys.puts(stdout) }
  19. exec("bash /home/shoutcast/mkdir.sh", puts);
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. root@fuzzyhost:~/NodeScripts# node script.js
  27. #!/bin/bash
  28. NEWDIR="Test"
  29. mkdir /home/shoutcast/$NEWDIR
  30.  
  31.  
  32. root@fuzzyhost:~/NodeScripts# node script.js
  33. #!/bin/bash
  34. NEWDIR="Test"
  35. mkdir /home/shoutcast/$NEWDIR
  36.  
  37.  
  38. root@fuzzyhost:~/NodeScripts# node script.js
  39. #!/bin/bash
  40. NEWDIR="Test"
  41. mkdir /home/shoutcast/$NEWDIR
Advertisement
Add Comment
Please, Sign In to add comment