homepage Welcome to WebmasterWorld Guest from 54.146.175.204
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Cronjob
ocon

5+ Year Member



 
Msg#: 4321585 posted 3:51 pm on Jun 3, 2011 (gmt 0)

I'm setting up a CMS and its having me setup some cronjobs:

0,20,40 * * * * /cron/randomizer.php 1>&2>> /custom/tmp/projectname_cron.log
10,30,50 * * * * /cron/renewal_reminder.php 1>&2>> /custom/tmp/projectname_cron

I know what the first couple parts are, but I'm lost at "1>&2>>" and beyond.

Is this is a way to save any output to a log file? Does it affect how the cron job runs? Would the cronjob run the same way without the last part?

Thanks

 

lammert

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4321585 posted 6:14 pm on Jun 3, 2011 (gmt 0)

The second part is to put the output of the commands in a log file. 1 and 2 are the stream numbers of the stdout and stderr output streams where all common programs write their output. With an interactive terminal session, these two streams are connected with the terminal of the user. With a cronjob, there is no terminal assigned and the information is lost, unless it is redirected to a file or other stream.

The 1>&2 part first combines the two streams to one data stream and the >> /custom/tmp/projectname_cron.log part appends the information to the log file.

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4321585 posted 10:50 pm on Jun 3, 2011 (gmt 0)

I remember trying to figure this out at one point :)
[webmasterworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved