Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Cron Job Help - Overwriting A File Every 3 Hours
AshleyQuick
post Oct 24 2004, 10:18 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 24-October 04
Member No.: 4,019



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

This post has been edited by AshleyQuick: Oct 24 2004, 10:40 AM
Go to the top of the page
 
+Quote Post
hughesjr
post Oct 24 2004, 11:08 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



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.


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
AshleyQuick
post Oct 24 2004, 01:15 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 24-October 04
Member No.: 4,019



Works beautifully. Thanks!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2017 - 05:30 PM