note 115206 added to function.exec

From: Date: Thu, 12 Jun 2014 11:51:07 +0000
Subject: note 115206 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-199664@lists.php.net to get a copy of this message
If you're trying to run something in the background on a system that uses systemd for its init, use the systemd-run utility to start your program in the background. systemd-run will run the command in a transient unit file so that you can query its status with systemctl and view its log with journalctl. <?php $lastline = exec('systemd-run --unit=my_unit_name /path/to/my/long_running_program arg1 arg2', $output, $exitval); ?> systemd-run returns immediately, launching your application for you and keeping track of it, so you don't need to worry so much about a forgotten process running on your server. From here you can query its status with <?php $lastline = exec('systemctl status my_unit_name', $output, $exitval); ?> And see its log with <?php $lastline = exec('journalctl -u my_unit_name', $output, $exitval); ?> ---- Server IP: 216.194.115.244 Probable Submitter: 64.58.242.163 ---- Manual Page -- http://php.net/manual/en/function.exec.php Edit -- https://master.php.net/note/edit/115206 Del: integrated -- https://master.php.net/note/delete/115206/integrated Del: useless -- https://master.php.net/note/delete/115206/useless Del: bad code -- https://master.php.net/note/delete/115206/bad+code Del: spam -- https://master.php.net/note/delete/115206/spam Del: non-english -- https://master.php.net/note/delete/115206/non-english Del: in docs -- https://master.php.net/note/delete/115206/in+docs Del: other reasons-- https://master.php.net/note/delete/115206 Reject -- https://master.php.net/note/reject/115206 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199664) next »