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?
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.backupobviously copies the log to a backup.This part
> /vold/www/Abcd/log/twitter_feed_item_aggregator.logoutputs the output of no command to the file, thus clearing it.