Skip to content

Commit

Permalink
upstart script
Browse files Browse the repository at this point in the history
  • Loading branch information
sharifashraful committed Mar 19, 2015
1 parent 18eae32 commit 88f6977
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
15 changes: 15 additions & 0 deletions deploy/upstart/grs-rush-wallet.conf
@@ -0,0 +1,15 @@
# this should live in /etc/init
description "GRS Rush Wallet"

# start process on system startup
start on filesystem
stop on shutdown

# Automatically Respawn:
respawn
respawn limit 20 5

script
cd /home/grs-rush-wallet
exec ../node/bin/node run groestlwallet
end script
4 changes: 2 additions & 2 deletions groestlwallet.js
Expand Up @@ -238,13 +238,13 @@ function Groestlwallet() {
self.on('init::websockets', function() {

self.webSocketsPublic = self.io.of('/pub-soc').on('connection', function(socket) {
console.log("public-websocket "+socket.id+" connected");
//console.log("public-websocket "+socket.id+" connected");

self.webSocketMap[socket.id] = socket;
socket.on('disconnect', function() {
delete self.webSocketMap[socket.id];
self.deleteAddSub( socket.id )
console.log("public-websocket " + socket.id + " disconnected");
//console.log("public-websocket " + socket.id + " disconnected");
})

socket.on('message', function(msg, callback) {
Expand Down
47 changes: 47 additions & 0 deletions run.js
@@ -0,0 +1,47 @@
//
// Copyright (c) 2011-2013 ASPECTRON Inc.
// All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//


var _ = require("underscore"),
spawn = require("child_process").spawn,
zutils = require("./lib/app-utils");

function Application() {
var self = this;
var args = process.argv.slice(2);

self.process = { }
_.each(args, function (name) {
console.log(('loading: ' + name).bold);

self.process[name] = new zutils.Process({
process: process.execPath,
args: [ name ],
descr: name,
logger: new zutils.Logger({ filename: __dirname + '/logs/' + name + '.log' })
});
self.process[name].run();
})
}

GLOBAL.app = new Application();

0 comments on commit 88f6977

Please sign in to comment.