- Where Developers Learn, Share, & Build Careers


Note that I know this is not the best or most optimal way to do this, but I have participated in it It's somewhere eager and I'm curious as the answer.

I have a Pearl script which is called an init which runs and sometimes dies. To debug it instantly, I have a quick wrapper Perl script that is originally set with the

  path # $ path. While joining (1) {system ("$ path / command.pl") ("", @ ARGV). "& Gt; & gt; / var / log / outlog 2 & gt; and 1"); So 30 # later added this one to the bottom ...}   

Press it from the command line and it runs properly and expected, Command.pl is called and the script Basically there will not stop again until the hair process dies.

However, when calling a start script (actually through start-stop-daemon), the system command returns immediately, command.pl is running. So it goes around to go one more and then again and again (it was not fun without order of sleep). PS shows (many) commands. The guardian of the page should be 1 compared to the wrapper script ID (which is when I run from the command line).

Anyone know what is going on?

Maybe command.pl might not be running successfully Execution is not permitted in the file (Do you have to say perl command.pl ?). You might think that you are running commands from a different directory and that the command.pl file is not found.

There are at least three things that you can see:

  1. The standard error output of your order for now, you can call it 2 & gt; & Amp; 1 Saying that you are swallowing, remove that part and see if the system generates the command.
  2. Return value of system The command can run and system can still return an acetcode, but if system 0 returns, you know that this command was successful.
  3. Pearl's error variable $! If there was a problem, then Pearl $! , which may or may not be helpful.

    In short, try:

      My $ ec = system ("command.pl> / var / log / outlog"); If ($ ec! = 0) {Warning "exit code is $ EC, $$! $!"; }   

    Update: If more than one instance of the command appears in your ps output, then it seems that the program is running in foreking and background only . If this is actually considered such an order, then what you not is, that command is run in an endless loop.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -