Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sys = require('sys');
- var exec = require('child_process').exec;
- var path = Math.floor(Math.random()*101);
- var fs = require('fs');
- fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
- if (err) {
- return console.log(err);
- }
- console.log(data.toString());
- var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="' + path + '"');
- fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
- if (err) return console.log(err);
- function puts(error, stdout, stderr) { sys.puts(stdout) }
- exec("bash /home/shoutcast/mkdir.sh", puts);
- });
- fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
- if (err) return console.log(err);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment