Guys, Many thanks to the over 20 people who replied. The "tee" command is the way to go and the following is what does what I wanted to achieve (needed to escape the "%" sign in the date command too...) 22 13 * * * /usr/local/bin/jumbo.sh 2>&1 | tee /tmp/jumbo.log.`date +\%Y.\%m.\%d` Cheers Loris -----Original Message----- From: Loris Serena Sent: 14 March 2005 12:43 To: 'sunmanagers@sunmanagers.org' Subject: cron job output to BOTH email AND log file. Hi Folks, I'm looking for a way to run a script via cron and get its output both to an email to crontab user and to a logfile. I might be wrong here, but if in my crontab I have 00 22 * * * /usr/local/bin/jumbo.sh then I only get an email to the crontab user and if I have 00 22 * * * /usr/local/bin/jumbo.sh > /tmp/jumbo.log.`date '+%Y.%m.%d'` then I only get the script output dumped to the logfile. Is there any way to get them both? TIA Loris Esat Telecommunications Limited is a wholly owned subsidiary of BT Group plc Registered in Ireland, Registration No. 141524 Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland This electronic message contains information (and may contain files) from Esat Telecommunications Limited which may be privileged or confidential. The information is intended to be for the sole use of the individual(s) or entity named above. If you are not the intended recipient be aware that any disclosure, copying, distribution or use of the contents of this information and or files is prohibited. If you have received this electronic message in error, please notify us by telephone or email (to the numbers or address above) immediately. http://www.esatbt.com _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagers Esat Telecommunications Limited is a wholly owned subsidiary of BT Group plc Registered in Ireland, Registration No. 141524 Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland This electronic message contains information (and may contain files) from Esat Telecommunications Limited which may be privileged or confidential. The information is intended to be for the sole use of the individual(s) or entity named above. If you are not the intended recipient be aware that any disclosure, copying, distribution or use of the contents of this information and or files is prohibited. If you have received this electronic message in error, please notify us by telephone or email (to the numbers or address above) immediately. http://www.esatbt.com _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Mon Mar 14 08:32:29 2005
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:44 EST