First CronJob! Many many questions....

First CronJob! Many many questions....

Posted by: Spearfish
Posted on: 2008-04-10 06:24:00

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. :( 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

Re: First CronJob! Many many questions....

Posted by: hugoh
Posted on: 2008-04-10 08:25:00

In reply to:


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. :( I do have a user with shell access though (I did read the wiki, it just didn't make sense to me)


Type to edit the crontab:

crontab -e

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

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

In reply to:


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.


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

chmod 700 <your script>

Tags: php scriptspearwikishellchecksjobs