First CronJob! Many many questions

software development

#1

Alright, so I’m trying to run a CronJob where every day a PHP script executes that deletes any users who have not activated their account. I can get the actual code down easy but I’ve never done cronjobs

But I have a couple of questions.

  1. How do I set it up? I have no experience with the command line. :frowning: I do have a user with shell access though (I did read the wiki, it just didn’t make sense to me)

  2. How do I protect the file? Users with dishonest intentions could potentially find the file, and then run the script themselves. This is not as much a problem with this CronJob (because it checks dates), but for future jobs I will want to know.

Thanks a ton,
-Spear


#2

Type to edit the crontab:

crontab -eIf you want you script to run say every day at 5am, add the following line:

0 5 * * * <path to your PHP script>

Do not store the script in your Web area, and set make it only readable and executable by you:

chmod 700 <your script> $50 off when signing up with MAXCASHDISCOUNT or get a list of the best DreamHost promo codes on the Web.