Question

I am learning about cronjob and I found this piece of code in one project which fetches record from twitter,

the code goes like this:

#0 * * * * cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup; > /vold/www/Abcd/log/twitter_feed_item_aggregator.log   

Can anyone explain what this piece of code does?

Was it helpful?

Solution

Hm... Copies a twitter agregator log each hour, and then clears it.

This part 0 * * * * means 'every 0 minutes'. Minute 0 is when a new hour starts.

This part cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup obviously copies the log to a backup.

This part > /vold/www/Abcd/log/twitter_feed_item_aggregator.log outputs the output of no command to the file, thus clearing it.

OTHER TIPS

The hash at the start of the line comments out the line so it does nothing. Without that it would do as @playcat says.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top