Run Perl Mojolicio Server from SSH -
i have mojolicio server on machine connect machine. have script checks if mojolicio - , run if not running. use following command line run server:
ssh root@hostname 'cd /server_path/; (nohup /usr/bin/perl server_file >nohup.out &);'
the server_file script raise server has following script:
#!/usr/bin/env perl use mojo::base -strict; use file::basename 'dirname'; use file::spec::functions qw(catdir splitdir); # source directory has precedence @base = (splitdir(dirname(__file__)), '..'); $lib = join('/', @base, 'lib'); -e catdir(@base, 't') ? unshift(@inc, $lib) : push(@inc, $lib); # start commands application require mojolicious::commands; mojolicious::commands->start_app('myserver', 'daemon','-l','http://*:3030');
if server down , run command - see in machine server , running , listening port configured listen to. now, if try connect server browser don't not load. stuck on loading , in end got page not found. if run same command server works , can load homepage after runs.
i found problem..
if use nohup ssh server somehow won't reachable - when run server without nohup example - using following code:
ssh root@hostname 'cd /server_path/; (usr/bin/perl server_file );'
it works.
what may problem here?
thanks lot.
i found solution :-) - problem nohup command - missing the:
2>nohup.out
i added , works now.
thanks everybody.
Comments
Post a Comment