Jai
Jai

Reputation: 65

Starting the redis server by javascript?

How to run the redis by script, instead of manual start using "redis-server" ...

Upvotes: 3

Views: 2708

Answers (2)

kirilloid
kirilloid

Reputation: 14304

As described in Execute a Unix Command with Node.js:

var sys = require('util')
var exec = require('child_process').exec;

function puts(error, stdout, stderr) {
    sys.puts(stdout)
}

exec("redis-server", puts); 

Upvotes: 3

chrislovecnm
chrislovecnm

Reputation: 2611

I do not recommend that you do this over tcp. This is a big security hole that you are opening. There are plenty of tools for starting remote services over tcp. Just to name a couple on unix Plexus and even ssh.

What is the biz requirement for this?

@Dvir Volk recommended using the start script and setting up redis as a service.

Upvotes: 1

Related Questions