iseif has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Run Perl Mojolicio Server from SSH
by Anonymous Monk on Feb 06, 2014 at 10:43 UTC | |
by iseif (Novice) on Feb 06, 2014 at 10:52 UTC | |
by Anonymous Monk on Feb 06, 2014 at 10:54 UTC | |
by iseif (Novice) on Feb 06, 2014 at 11:14 UTC | |
by Anonymous Monk on Feb 06, 2014 at 11:30 UTC | |
|