开发者

Run screen from Perl

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜