Help - Search - Members - Calendar
Full Version: Cron Job Help - Overwriting A File Every 3 Hours
Linuxhelp > Support > Technical Support
AshleyQuick
I have a small txt file entitled /edit/news.txt How is it possible, using a cron job, to overwrite this file with /edit/cron/news.txt every 3 hours?

/edit/news.txt is a dynamic file that contains content that is displayed for a news publisher script demo. I want my site's users to be able to use the demo in a normal fashion but, as you can imagine, every now and then someone will post unsavory content Consequently, I thought this would be an efficient, and automatic, solution to overwrite the dynamic txt file with my default txt file that I will place in the cron folder.

Here is a screenshot of the cron manager interface that is available to me via my web host:



Thanks,

Ashley
hughesjr
05 0,3,6,9,12,15,18,21 * * * cp /edit/cron/news.txt /edit/news.txt


That will copy the file /edit/cron/news.txt to /edit/news.txt at 0005, 0305, 0605, 0905, 1205, 1505, 1805, and 2105 everyday...

You have to create a file at /edit/cron/news.txt to copy.
AshleyQuick
Works beautifully. Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.