Cron Job (old file deletetion)

software development

#1

Okay, so basically, I just found out that using Cron I can delete files more than X days old every few days in a directory I specify. My issue is that I’m not really sure what to do next.

I’ve searched high and low on Google, and asked on another forum, but nothing was of too much help to me, so I’m hoping someone here using DH has used Cron on a site hosted by DH to help me with it.

Basically, the farthest I’ve gotten is seeing this code on every page that talked about deleting old files:

find /yourdir/tmp -mtime +1 -exec rm {} ; //where 1 is number of days since it was modified

I have NO clue how to execute this code, or where to put it, or whatever. I’ve seen mentions of telnet and ssl, but if that’s the case, then I need help with that too.

I’m avoiding using PHP, since it’s not helpful for every day auto-deletion, at least from what I’ve seen and tried.

Any help would be GREATLY appreciated. :slight_smile:


#2

What OS are you using? To use telnet in Windows XP, go to a Command Prompt window and simply type telnet example.com and you should be prompted for your username and password.

There is no security with telnet, so you may wish to use SSH instead.

The DreamHost Wiki documentation on Crontab should help.

:cool: [color=#6600CC]Atropos[/color] | openvein.org


#3

Yes, thank you, I was looking at that page earlier, but I don’t know how to work with SSH. Telnet seems too risky for me, since I’m a beginner and never knew what either of those were capable of doing until today.

:slight_smile:


#4

The only thing risky about telnet is that what you type and what you send could be logged. SSH is encrypted so even though it can also be logged - it would be encrypted and very hard to break.

The reality is that of the trillions of packets moved every day, someone would have to target you specifically.

Use SSH if you can, but go ahead and use telnet if you have to. There’s no real usability difference between them (telnet can’t do anything more dangerous than ssh short of exposing what you’re doing)

Wholly - Use promo code WhollyMindless for full 97$ credit. Let me know if you want something else!