Wiki Forum Sign up! Explore Home

Not signed in (Sign In)

LiveSearch

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.2 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorHesadanza
    • CommentTimeSep 26th 2007
     permalink
    I've tried a bunch of things to try to keep the push server running, without any luck. I've attempted to put it in the startup of the server, no luck. Tried starting it with nohup, no luck. What would you suggest to keep it running? I'm running FreeBSD.

    Thanks,
    hesadanza
    • CommentAuthoradmin
    • CommentTimeSep 26th 2007
     permalink
    I tend to stick the daemons into a screen session, and then detach from that and reattach wherever I sit if I want to monitor what's happening.

    -- Erlend
    • CommentAuthorHesadanza
    • CommentTimeSep 26th 2007
     permalink
    I try to start the daemon from a SSH session, and detach with the "nohup" command, but if I exit the session or if the session ends unexpectedly, the daemon is shutdown.

    What are the commands you use?

    hesadanza
    • CommentAuthoradmin
    • CommentTimeSep 27th 2007 edited
     permalink
    Install and start screen:
    cd /usr/ports/sysutils/screen; make install clean; rehash; screen

    and press any key to create a shell.

    with tcsh:
    while (1)
    ./lib/daemons/push_server.rb
    sleep 2
    end


    with bash:
    while [ 1 ]; do ./lib/daemons/push_server.rb; sleep 2; done;

    and finally to detach the screen session:
    <ctrl-a d>

    -- Erlend
    • CommentAuthorari
    • CommentTimeSep 6th 2008
     permalink
    We've done something similar to keep it going on our setup (also BSD). But this hackery with screen is ugly and means that start and stop scripts cannot be written to ensure the service survives server reboot or even so it can be restarted easily after an upgrade.

    What is it about the push server which makes it require an active shell? Is there a lot of effort to make it work like a regular daemon?
    • CommentAuthoradmin
    • CommentTimeSep 6th 2008
     permalink
    There's no reason it can't run in the background other than some people struggling with getting it going and seeing the output helps while getting things going.

    These days I generally suggest that people just nohup it, and leave it running in the background.

    -- Erlend
    • CommentAuthorari
    • CommentTimeSep 6th 2008
     permalink
    I see. I'll add that to the instructions page. Is the reason nohup is needed here is that the push server invokes

    #!/usr/bin/env ruby

    rather than just

    #!/usr/local/bin/ruby

    and therefore it depends on the environment of the running shell?
    • CommentAuthoradmin
    • CommentTimeSep 6th 2008
     permalink
    No, but if you just background it with &, you either won't be able to log out, or the process will die once you do.

    -- Erlend
    • CommentAuthorari
    • CommentTimeSep 6th 2008
     permalink
    Yes, I understand that's what happens, but the question is why. Lots of other applications I can start from the terminal and background, and they continue running happily after I log out. They don't depend on the shell persisting. But this one is different and I was wondering whether the use of 'env' is what links it to the shell in this way.
    • CommentAuthoradmin
    • CommentTimeSep 6th 2008
     permalink
    It's just a shell script which starts a ruby program. If that were to work, it'd have to fork off a background process, and leave that running while exiting the wrapper. I haven't looked at how this is done from Ruby, but it can't be all that hard. :-)

    -- Erlend