kewlhotrod

Untitled

Jul 1st, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 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. );
  21. });
  22.  
  23. //Extra write to write path (whole process isn't done yet, still need to add variables and whatnot but I'm stuck on this, no matter where I place it.
  24.  
  25. fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
  26. if (err) return console.log(err);
  27. }
  28.  
  29.  
  30.  
  31.  
  32. root@fuzzyhost:~/NodeScripts# node script.js
  33.  
  34. /root/NodeScripts/script.js:28
  35. });
  36. ^
  37. SyntaxError: Unexpected token }
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. var sys = require('sys');
  56. var exec = require('child_process').exec;
  57. var path = Math.floor(Math.random()*101);
  58.  
  59. var fs = require('fs');
  60.  
  61. fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
  62. if (err) {
  63. return console.log(err);
  64. }
  65. console.log(data.toString());
  66. var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="' + path + '"');
  67.  
  68. fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
  69. if (err) return console.log(err);
  70. function puts(error, stdout, stderr) { sys.puts(stdout) }
  71. exec("bash /home/shoutcast/mkdir.sh", puts);
  72. }
  73. //Extra write to write path (whole process isn't done yet, still need to add variables and whatnot but I'm stuck on this, no matter where I place it.
  74.  
  75. fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
  76. if (err) return console.log(err);
  77. );
  78. });
  79.  
  80.  
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. root@fuzzyhost:~/NodeScripts# node script.js
  89.  
  90. /root/NodeScripts/script.js:21
  91. fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
  92. ^^
  93. SyntaxError: Unexpected identifier
  94. at Module._compile (module.js:439:25)
  95. at Object.Module._extensions..js (module.js:474:10)
  96. at Module.load (module.js:356:32)
  97. at Function.Module._load (module.js:312:12)
  98. at Function.Module.runMain (module.js:497:10)
  99. at startup (node.js:119:16)
  100. at node.js:901:3
Advertisement
Add Comment
Please, Sign In to add comment