2
x.php:
<?php
sleep(15);
?>
console:
$ php x.php &
[1] 5742
[1]+ Stopped x.php
Result: a "STOPPED" process - it's there forever until I send a TERM
and then CONT
signal.
What I need instead: the process to finish and quit after 15 seconds, so I don't see it in top
or htop
.
System: Ubuntu 12.04 LTS in VirtualBox; php-fpm
Actually it is not about "how to code something", but about "how to run my script in background", which looks more like a question related to "power users", as stated in the website's Tour. Re: what you are trying to do - that's described in the "What I need instead" paragraph. – Meglio – 2014-01-08T19:09:59.240
1Is there more to
X.php
, or did you just forget to close your PHP tag in the example? – Ƭᴇcʜιᴇ007 – 2014-01-08T19:19:43.997Nothing else in x.php file (it's allowed and recommended to omit closing tag). Fixed my question to avoid confusion. – Meglio – 2014-01-08T19:40:49.360
Why would you want to do this? It would be easier to just run
sleep 15
instead ofphp
. – Kevin Panko – 2014-01-08T22:31:04.130@KevinPanko The PHP script is just a minimal example used for simplified testing and posting to this website - it was used in replacement of the real workhorse-script. – Meglio – 2014-01-09T01:44:35.817
@KevinPanko , questioning why I use PHP instead of something else doesn't help with my original question. Instead it just changes direction of the discussion, unfortunately. – Meglio – 2014-01-09T01:48:28.520
There may be a simpler/better way to do what you want to do. http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
– Kevin Panko – 2014-01-09T01:52:56.787