how to set up a cron job
Moderator: General Moderators
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
how to set up a cron job
erm.can't seem to search properly:-/ How do you set up a cron job if there isn't an option on my vdeck?is there any way to code one?if so where? i'm on a shaerd server.
Sometimes your account control panel can give you access to cron. If you have to get support to set it up, I'd suggest you ask them to just make a cron job for a control file of yours. You can then use that control file to call other files depending on the time. That way, if you want to add more cron jobs, you just modify the control file, rather than talking to support again.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
If you don't have shell access, then you've really only got two options.
The first option is to talk to support and see if they can set up a cron job for you. If you do this, then I'm back to suggesting you use (what I called) a control file. What I'd suggest is get support to run your file (say: example.php) every 10 minutes. Then, in example.php, you check the time and depending on the actual time, you run particular files - essentially your own copy of cron.
The second option is to tie in whatever you want cronned into the template of your website (if this isn't for a website, this might not work). So, you could just run whatever you wanted cronned, on the first page load of the hour. This'll make the first page load a bit slower, and won't guarantee you get your stuff done every hour on the hour, but you might not have a choice if support can't/won't set up a cron job for you.
The first option is to talk to support and see if they can set up a cron job for you. If you do this, then I'm back to suggesting you use (what I called) a control file. What I'd suggest is get support to run your file (say: example.php) every 10 minutes. Then, in example.php, you check the time and depending on the actual time, you run particular files - essentially your own copy of cron.
The second option is to tie in whatever you want cronned into the template of your website (if this isn't for a website, this might not work). So, you could just run whatever you wanted cronned, on the first page load of the hour. This'll make the first page load a bit slower, and won't guarantee you get your stuff done every hour on the hour, but you might not have a choice if support can't/won't set up a cron job for you.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm