开发者

Run screen from Perl

开发者 https://www.devze.com 2023-03-05 08:31 出处:网络
I have a Jar file that I would like to run through screen, although when I try to open the Perl script everythi开发者_高级运维ng seems to be working fine, although when I do top I do not see the proce

I have a Jar file that I would like to run through screen, although when I try to open the Perl script everythi开发者_高级运维ng seems to be working fine, although when I do top I do not see the process in the list, it works just fine if I copy-paste the command into the SSH session...

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 point out why this is?


The problem is that screen is trying to grab hold of the terminal, which isn't possible given the context of the system command. The easiest solution is to start the screen session in detached mode by adding the -d -m options:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号