logging - separating stdout and sterr in cron jobs -


***i'm not sure if belongs here on on serverfault seems borderline. if serverfault better, please shift on , apologies trouble.

i have task running on cron , want stderr , std out redirected file , stderr directed file. (note: script php)

i've tried things

<script> 1>> a.log 2>> | tee -a a.log | /bin mail -se 

and

<script> | a.log  2>> /bin/mail -se 

but can't seen right. either stdout winds in mail or double entries in log file etc.

i tried

<script> >> test.log  2> tee test.log | /bin/mail -s  

but email blank when introduced error. message displayed stdout upon start execution (the script takes 40 seconds complete): "null message body; hope that's ok"

finally found solution works

<script> 1 3>> <log> 2>&1 1>&3 | tee -a <log> | /bin/mail 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -