Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using ruby on rails application to implement chat. I am not able to setup juggernaut server in production mode.

I followed this guide to setup redis. and its working perfectly fine.

Then I followed this for setting up juggernaut. But when I am trying to start juggernaut its not working.

Here is the out for grep commands to check that redis is working but juggernaut is not.

enter image description here

When I am trying to stop/start redis server its gives me output ie:

 Starting/Stopping redis-server: redis-server.

But nothing when i m doing the same for juggernaut. Check screenshot.

enter image description here

Some other things to check what actually going on:

  1. Executable file permissions to /etc/init.d/juggernaut file -- YES

        -rwxr-xr-x 1 fizzy fizzy 1310 Sep 19 11:06 juggernaut
    
  2. PIDFILE=/var/run/juggernaut.pid' is defined. Does that exist? --- NO

  3. In the 'start' part it runs 'chown juggernaut:juggernaut'. Does the user juggernaut exist and is it member of the group juggernaut? -- YES/YES

      cat /etc/group
          redis:x:1002:
          juggernaut:x:113:
    
      groups juggernaut
          juggernaut : juggernaut
    
  4. Running sudo juggernaut start the server, but i want to it to keep on running in background process/service.

enter image description here

I am stuck now. Can anybody help me.

EDIT

    fizzy@li136-198:~$ sudo ls -l /usr/bin/juggernaut 
              ls: cannot access /usr/bin/juggernaut: No such file or directory
     fizzy@li136-198:~$ sudo ls -l /usr/local/bin/juggernaut 
            lrwxrwxrwx 1 root root 40 Sep 20 02:48 /usr/local/bin/juggernaut -> ../lib/node_modules/juggernaut/server.js

I tried changing

        DAEMON=/usr/bin/juggernaut

to

        DAEMON=/usr/local/bin/juggernaut

after that i tried restarting the juggernaut using

         sudo /etc/init.d/juggernaut start

Server started but not as background process/service.

EDIT

Running script in debuggin mode:

   + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
   + DAEMON=/usr/bin/juggernaut
   + NAME=Juggernaut2
   + DESC=Juggernaut2
   + PIDFILE=/var/run/juggernaut.pid
   + test -x /usr/bin/juggernaut
   + exit 0

EDIT

    fizzy@li136-198:~$ sudo /etc/init.d/juggernaut start
    + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    + DAEMON=/usr/local/bin/juggernaut
    + NAME=Juggernaut2
    + DESC=Juggernaut2
    + PIDFILE=/var/run/juggernaut.pid
    + test -x /usr/local/bin/juggernaut
    + set -e
    + case "$1" in
    + echo -n 'Starting Juggernaut2: '
    Starting Juggernaut2: + touch /var/run/juggernaut.pid
    + chown juggernaut:juggernaut /var/run/juggernaut.pid
    + start-stop-daemon --start --quiet --umask 007 --pidfile /var/run/juggernaut.pid --chuid juggernaut:juggernaut --exec /usr/local/bin/juggernaut
    20 Sep 06:41:16 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.
    20 Sep 06:41:16 - socket.io ready - accepting connections

    node.js:134
            throw e; // process.nextTick error, or 'error' event on first tick
            ^
    Error: EADDRINUSE, Address already in use
        at Server._doListen (net.js:1106:5)
        at net.js:1077:14
        at Object.lookup (dns.js:153:45)
        at Server.listen (net.js:1071:20)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/server.js:51:21)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/index.js:9:10)
        at Object.<anonymous> (/usr/local/lib/node_modules/juggernaut/server.js:21:12)
        at Module._compile (module.js:402:26)
        at Object..js (module.js:408:10)
        at Module.load (module.js:334:31)
    + echo failed
    failed
    + exit 0

Here is the out for all the used ports

tcp        0      0 localhost.localdom:9312 *:*                     LISTEN     
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN     
tcp        0      0 *:6379                  *:*                     LISTEN     
tcp        0      0 *:http-alt              *:*                     LISTEN     
tcp        0      0 *:www                   *:*                     LISTEN     
tcp        0      0 localhost.localdo:52433 *:*                     LISTEN     
tcp        0      0 *:ssh                   *:*                     LISTEN     
tcp        0      0 localhost.localdo:53784 *:*                     LISTEN     
tcp        0      0 *:smtp                  *:*                     LISTEN     
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN     
share|improve this question
    
Aside from anything else you certainly want the init.d file owned by root:root. –  poolie Sep 20 '11 at 7:18
    
When you say "not as background" do you mean the init script didn't complete? –  poolie Sep 20 '11 at 7:19
    
@poolie yaa.. I m sorry for using wrong terms... –  Mohit Jain Sep 20 '11 at 7:30
    
Let's continue this in a chat room –  poolie Sep 22 '11 at 1:45
add comment

1 Answer 1

What I would do to debug this sort of upstart problem is: edit /etc/init.d/juggernaut and change the shebang line at the top to add an -x, eg

#! /bin/bash -x

then try to start the service and you should see it print debug information, which hopefully will make it clear what's wrong.

update: the second last line

 + test -x /usr/bin/juggernaut

makes it pretty clear (to me :-) the init script is aborting because it thinks juggernaut is not installed. You need to update that line to point to /usr/local/bin/juggernaut.

update: "address in use" means another process is listening on that socket, maybe another copy of juggernaut. netstat -tpl will tell you.

share|improve this answer
    
Check my edit.. I think that make some sense.. –  Mohit Jain Sep 20 '11 at 7:11
    
Please actually run the command and add the output to your question. –  poolie Sep 20 '11 at 7:39
    
check it now..I edit my question –  Mohit Jain Sep 20 '11 at 9:09
    
yupp.. did that but now it saying some port is already in use.. :( –  Mohit Jain Sep 20 '11 at 10:45
    
check my edit now.. –  Mohit Jain Sep 20 '11 at 10:58
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.