- Code: Select all
<?php
if ($restart) {
// cron command is: php -q /home/myaccount/cron/script.php
exec('php -q /home/myaccount/cron/script.php');
exit;
}
else {
// rest of script
}
?>
Suggestions?
Also, I've seen extensions used for exec() and am not sure of how these could be used to track issues:
- Code: Select all
<?php
exec('nohup php -q /home/myaccount/cron/script.php > script.out 2> script.err < /dev/null &');
?>
Questions:
- Is the "nohup" needed?
- Should any/all of the "-q" and/or "< /dev/null" and/or trailing "&" be included?
- Should script.out and script.err be prefaced with the full path (i.e. /home/myaccount/cron/script.out)?
Thanks in advance for any help/suggestions.