Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've got a script that kicks off an app for a user. The developer likes to release things in "useable by sys admins, and not users" state, so I have to make it useable for the user.

The program is basically in two parts. A server and a GUI. The script takes arguments, and based on these arguments, will export some environment variables, kick off the server, then kick off the GUI.

Up until recently, this worked fine. However, I now need to run two back ends, and two GUI's. They communicate on dfiferent ports, and if I start everything up manually from the terminal, there is no problem. However, if I run the script twice, the second instance will kill the first instance. What I think is happening, is the 2nd server process is killing the first (and in turn, the GUI).

Since I can start two servers and two GUI's manually, all fingers are pointing to my script. I don't know too much about kicking off multiple system calls from a single perl script (like if it's a good or bad idea) so I'm a bit at a loss. Any help is appreciated.

Here's a very dumbed down version of the code. It should suffice.

#!/usr/bin/perl use strict; use warnings; my $server = $ARGV[0]; my $client = $ARGV[1]; my $display = $ARGV[2]; my $variable = $ARGV[3]; $ENV{"DISPLAY"} = $display . ":0.0"; my $bin = "/usr/local/bin/"; my $port = "2222" . ( $variable + 1 ); $ENV{"PORT"} = $port; #Start the server my $server_path = $bin . $server; system "$server_path &"; sleep 2; # Start up the client my $client_path = $bin . $client; system "$client_path";

In reply to Problems w/ system calls by GaijinPunch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-18 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found