node.js code implementation

Fermé Publié le Apr 14, 2012 Paiement à la livraison
Fermé Paiement à la livraison

I have this code:

var http = require('http')

, url = require('url')

, util = require('util')

, exec = require('child_process').exec;

var site = [login to view URL](80, "[login to view URL]", false);

var req = [login to view URL]("GET", "/");

[login to view URL]();

[login to view URL]('response', function(res){

if([login to view URL] !== 200){

// launch a new instance

var ec2 = require("ec2")

, fs = require("fs");

// Read in the configuration above.

var configuration =

[login to view URL]([login to view URL]("[login to view URL]", "utf8"));

// Create an ec2 function that uses your configuration.

ec2 = ec2(configuration)

// Run an instance and wait for it to become ready.

ec2("RunInstances", {

ImageId: "ami-XXXXXX"

, KeyName: "micros-ie"

, InstanceType: "[login to view URL]"

, MinCount: 1

, MaxCount: 1

}, function (error, response) {

if (error) {

throw error

}

ready();

});

} else {

[login to view URL]('data', function(chunk){

function puts(error, stdout, stderr) { [login to view URL](stdout) }

exec("my command", puts);

});

}

});

basically, i would like to launch a new EC2 instance if the status code is not equal to 200. this works ok, but my problem is that when the code goes into the 'else' loop, i would like to check if the 'site' still returns a 200 status code.

So, i need this to be put into a function and then use recursion.

Also, the output of the exec("my command", puts); needs to be fed into a redis database.

JavaScript Node.js

Nº du projet : #1564347

À propos du projet

5 propositions Projet à distance Actif May 19, 2012

5 freelances font une offre moyenne de 88 € pour ce travail

solutionswithus

We have an expert team for javascript and database handling.... Please provide a chance to work with you. Hope for good response.

€130 EUR en 3 jours
(4 Commentaires)
6.1
jeffmarketing

PLEASE CHECK PMB

€150 EUR en 3 jours
(0 Commentaires)
0.0
Crum

Hello ! im a student of nodejs, and i can do this !

€30 EUR en 3 jours
(0 Commentaires)
0.0
l0nwlf

Not much experience with node as well as handling EC2 instances but what you require seems simple enough to increase my node-foo. Please pick while keeping in mind the aforementioned factor. :)

€30 EUR en 4 jours
(0 Commentaires)
0.0