jobbyphp / jobby

Manage all your cron jobs without modifying crontab. Handles locking, logging, error emails, and more.
https://packagist.org/packages/hellogerard/jobby
MIT License
1.05k stars 154 forks source link

Split stdout and stderr in different files #103

Closed qconer closed 6 years ago

qconer commented 6 years ago

feature to allow splitting stdout and stderr output

hellogerard commented 6 years ago

@qconer Hi, this looks great. Can you convert all your tabs to spaces before I merge this PR? It's throwing off the diffs.

qconer commented 6 years ago

@qconer Hi, this looks great. Can you convert all your tabs to spaces before I merge this PR? It's throwing off the diffs.

@hellogerard Hi. Already.

This PR also closing an issue https://github.com/jobbyphp/jobby/issues/79

garethellis36 commented 6 years ago

This change breaks Jobby on Windows. Any jobs which have an output file specified result in the following error: The process cannot access the file because it is being used by another process

I did some debugging and found that the culprit is the exec line in BackgroundJob. When an output file is specified and no stderr is specified, Windows tries to write to the same file for both with the following syntax: exec("$useSudo $command 1>> \"$stdoutLogfile\" 2>> \"$stderrLogfile\"", $dummy, $retval);

However, this is not valid syntax for Windows. The correct syntax is shown here.