commit
9953318982
17
lxc.js
17
lxc.js
@ -1,14 +1,19 @@
|
||||
'use strict';
|
||||
var cmd = require('node-cmd');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
var sysExec = function(command, callback){
|
||||
// console.log('sysExec: ', command, '||| callback:', callback)
|
||||
cmd.get('unset XDG_SESSION_ID XDG_RUNTIME_DIR; cgm movepid all virt $$; '+command, callback);
|
||||
function sysExec(command,callback){
|
||||
command = 'unset XDG_SESSION_ID XDG_RUNTIME_DIR; cgm movepid all virt $$; ' + command
|
||||
exec(command,(function(){
|
||||
return function(err,data,stderr){
|
||||
if(!callback) return;
|
||||
callback(data, err, stderr);
|
||||
}
|
||||
})(callback));
|
||||
};
|
||||
|
||||
var lxc = {
|
||||
create: function(name, template, config, cbComplete){
|
||||
sysExec('lxc-create -n '+name+' -t '+template, cbComplete);
|
||||
create: function(name, template, config, callback){
|
||||
sysExec('lxc-create -n '+name+' -t '+template, callback);
|
||||
},
|
||||
|
||||
clone: function(name, base_name, callback){
|
||||
|
@ -14,10 +14,6 @@
|
||||
"morgan": "~1.6.1",
|
||||
"serve-favicon": "~2.3.0",
|
||||
"node.extend": "~1.1.5",
|
||||
"redis": "~2.4.2",
|
||||
"child": "0.0.3",
|
||||
"colors": "~1.1.2",
|
||||
"async": "~1.5.2",
|
||||
"node-cmd": "~1.1.1"
|
||||
"redis": "~2.4.2"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ var extend = require('node.extend');
|
||||
var redis = require("redis");
|
||||
var client = redis.createClient();
|
||||
var lxc = require('../lxc');
|
||||
//lxc.startEphemeral('ubuntu_template', 'ue0', function(){console.log('cb1', arguments)}, function(){console.log('cb2', arguments)})
|
||||
|
||||
router.get('/start/:name', function(req, res, next){
|
||||
lxc.start(req.params.name, function(status, message){
|
||||
if(status){
|
||||
|
Loading…
x
Reference in New Issue
Block a user