Hey,

I have a mojolicio server on a machine where I connect to it from another machine. I have a script that checks if the mojolicio is up - and run it if it is not running. I use the following command line to run the server:

ssh root@hostname 'cd /server_path/; (nohup /usr/bin/perl server_file >nohup.out &);'

The server_file contains the following code that raise the server:

#!/usr/bin/env perl use Mojo::Base -strict; use File::Basename 'dirname'; use File::Spec::Functions qw(catdir splitdir); # Source directory has precedence my @base = (splitdir(dirname(__FILE__)), '..'); my $lib = join('/', @base, 'lib'); -e catdir(@base, 't') ? unshift(@INC, $lib) : push(@INC, $lib); # Start commands for application require Mojolicious::Commands; Mojolicious::Commands->start_app('MyServer', 'daemon','-l','http://*:3 +030');

If the server is down and I run this command - I see in the machine that the server is up and running and it listening to the port it configured to listen to. Now, if I try to connect to the server from the browser it don't not load. It stuck on loading and in the end I got page not found. But if I run the same command from the server itself it works and I can load the homepage after it runs.

I found the problem..

If I use the nohup with the ssh then the server somehow won't be reachable - but when I run the server without the nohup as for example - using the following code:

ssh root@hostname 'cd /server_path/; (usr/bin/perl server_file );'

it works.

What i'm doing wrong here?

Thanks a lot.

In reply to Run Perl Mojolicio Server from SSH by iseif

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.