Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 06:39:42 PM

Pages: [1]   Go Down
  Print  
Author Topic: flashing file on server  (Read 420 times)
durangod
Galactic Royalty
*****
Offline Offline

Posts: 203


« on: February 16, 2010, 08:16:01 AM »

Hi, I have a file on my server that i need to set up to flash once a day if i can.   by flash i mean clear it and reset it.  

its a html file that contains my text from my site chat, as people chat the file builds up with text, minimun once a day i need to clear all the chat text out of this file so it does not build up.

first how is this done, thru htaccess or cron or what

second, is this hard do set up for the average person, i have done some reading and wow what i found was pages of complicated script, there has to be an easier way.

third, is is better to just clear the file, or create an archive and rename it to archive each time..

thanks
« Last Edit: February 16, 2010, 08:17:34 AM by durangod » Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #1 on: February 16, 2010, 09:27:00 AM »

It's done with a cron job. Set the minute and hour fields to the desired time, and leave the day, month, and day of week as "*". The command,
Code:
cp /path to fresh copy/freshcopy.html /path to where file lives/filename.html

should do it. It will overwrite your existing copy once a day with a fresh copy of the file. If you wish to archive the old copy first, that can be done, but it's more complicated.
Logged

durangod
Galactic Royalty
*****
Offline Offline

Posts: 203


« Reply #2 on: February 16, 2010, 10:18:26 AM »

ok thanks so here in what i have in the cp cron job command line entry

Quote
cp http://xxxxxx.com/chat/freshcopy.html /http://xxxxxx.com/chat/msg.html


the file is named msg.html that i want to refresh.
and that address is ok right, i mean i dont need to use the litteral address with server name right. just the domain is fine.
does that look correct to you?

afterthought should i make a new blank file and name it freshcopy.html
« Last Edit: February 16, 2010, 10:46:50 AM by durangod » Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #3 on: February 16, 2010, 11:18:53 AM »

No. It's the full Linux path name, not http:.
Code:
cp /home/ACCOUNTNAME/public_html/path.../freshcopy.html /home/ACCOUNTNAME/public_html/path.../filename.html
Logged

Pages: [1]   Go Up
  Print  
 
Jump to: