Launch a screen with Perl

I have a Jar file that I would like to run through the screen, although when I try to open the Perl script everything works fine, although when I do top, I don’t see the process in the list, it works fine if I copy the command to the session Ssh ...

This is the code I'm using:
start.pl

# !/usr/local/bin/perl
system("cd /var/server/; screen java -Xmx1024M -Xms1024M -jar jarfile.jar > /dev/null 2>&1 &");

Can someone indicate why this is?

+5
source share
1 answer

The problem is that the screen is trying to capture the terminal, which is not possible in the context of the command system. The simplest solution is to start a screen session in disconnected mode by adding options -d -m:

# !/usr/local/bin/perl
system("cd /var/server/; screen -d -m java -Xmx1024M -Xms1024M -jar jarfile.jar > /dev/null 2>&1 &");
+6

All Articles