Old 04-06-2008, 08:26   #1 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,734
htacess? is this possible?

I have been asked to deal with the feed from a digital camera.

The camera drops a new file every five minutes into a folder.

The client does not want an accumulation of files so wants the files to be deleted once replaced with newer.

The files are named including a timestamp and all are unique.

Is it possible on the server side to see any new file arriving and rename it to eg camera1.jpg and replace the previous camera1.jpg?

Then I can simply set a page refresh rate and continue to ask for the same pic with no issues on the delivery side.

Any help apreciated.
__________________
  Reply With Quote
Old 04-06-2008, 08:54   #2 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,192
You could set up a cronjob (if you are on an apache server) to run every five minutes, and check for the presence of any files not named camera1.jpg, and if one exists, rewrite the name to camera1.jpg. You may need to delete camera1.jpg first though - I don't know if renaming the file will allow you to overwrite already existing files, although I assume that it will.

You may need to tweak this a little, but you should be able to do it. Functions you can use:

blob - to get the names of the files in the directory
rename - to rename the file.

Use a couple 'if' statements and it should be a fairly basic script!
__________________
This space for rent.

Don't click this link.
Dudes Japan
  Reply With Quote
Old 04-06-2008, 09:21   #3 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,734
Thanks Haku, I will investigate that. Trouble with my server is it sends an email out everytime a cron job runs. But that could work. I can write the code in a PHP file and just run that every five mins. Yes, yes, thanks. Direct the email to client. Hahahahahhahahaahahahaaahahhha!
__________________
  Reply With Quote
Old 04-06-2008, 09:48   #4 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,192
Heh!

My server has the email as an option, its not mandatory. Can you not do that?

If not, then just point it at a non existent email address. The job should still run, the mail will just go nowhere.
__________________
This space for rent.

Don't click this link.
Dudes Japan
  Reply With Quote
Old 04-06-2008, 10:05   #5 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,734
Nope tried that before, bloody tests the email address is valid. Is accessed though cpanel so I probably don't have full functionality perhaps. I will check it again.
__________________
  Reply With Quote
Old 04-06-2008, 10:08   #6 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,192
What a pain in the ass!

Pipe it to the client! haha
__________________
This space for rent.

Don't click this link.
Dudes Japan
  Reply With Quote
Old 09-06-2008, 10:56   #7 (permalink)
Hinkle
Pixelpoodle.com
 
Join Date: Sep 2007
Location: Leuven, Belgium
Posts: 70
make a hotmail account for them, or just a mailaccount on your servers domain for that matter... and never ever read em
  Reply With Quote
Old 09-06-2008, 12:46   #8 (permalink)
MikeMackay
Everything is fine.
 
MikeMackay's Avatar
 
Join Date: Feb 2005
Location: Witham & London
Posts: 774
Send a message via MSN to MikeMackay Send a message via Skype™ to MikeMackay
Usually CRON mails you if your script outputs anything to STDOUT. I'd double check to make sure it doesn't ECHO anything etc.

Otherwise, you should be able to redirect any output to /dev/null and everyything should end up there instead of your inbox; although using this method won't alert you if you script f**ks up for any reason. So use with caution.

Edit: You haven't got your email address entered in this box have you "Please enter an email address where the cron output will be sent:"; lol. That would certainly cause it!
__________________
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8