Reputation: 176
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?
Upvotes: 0
Views: 96
Reputation: 53320
The hash at the start of the line comments out the line so it does nothing. Without that it would do as @playcat says.
Upvotes: 2
Reputation: 2555
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.
Upvotes: 3