View Full Version : Cron job for RSS posts instead of vb script
John Diver
10-03-2012, 09:12 AM
Hey
I want to run RSS posts by cron instead of the default RSS poster, has anyone done this?
Thanks!
John Diver
10-05-2012, 12:33 PM
Can anyone help please?
Thanks :)
Brandon Sheley
10-05-2012, 01:49 PM
It is by cron isn't it??
I mean a task is what fires off the rss poster if I remember correctly.
I think he's probably asking for a way to run it as an operating system cron job instead of the way vb does it (which is driven by users visiting). It was discussed a bit in this thread: www.vbulletin.org/forum/showthread.php?t=279649 but I'm not sure if that person found a solution or not.
BirdOPrey5
10-06-2012, 11:13 AM
Maybe a cron job that just visits the forum every hour or so it forces all scheduled tasks to run?
John Diver
11-02-2012, 05:25 PM
Sorry for the late reply!
Doing that would work Joe but I think vB only runs the cron when an actual user visits, maybe when an image is loaded (I think).
Would it work by setting a cron to load the image which would then run the cron?
Would it work by setting a cron to load the image which would then run the cron?
Seems like it should. But since there isn't any way to specify that you want it to run the RSS task, you'd have to call it multiple times to make sure all the cron tasks are executed, and I don't think there's any way to tell for sure when they are.
John Diver
11-03-2012, 09:07 PM
Hmmm...I don't know what I can do really..I am missing a lot of posts because I have to do it manually :(
Has no-one else done this successfully before?
Thanks kh99 :)
Well, there's this thread you might want to read: https://www.vbulletin.com/forum/showthread.php/392395-Ability-to-run-Scheduled-Tasks-via-real-system-cron-VBIV-13733 . In post 6 Wayne posts a command line you can use in a cron job, and he mentioned that if you just set it to run every 30 seconds then it should take care of the problem of running it multiple times (because it doesn't do anything if there's nothing to do, so apparently it doesn't matter much if it's run too often). Also if you do that you could remove the cron image from your footer.
Anyway, later in that thread Wayne talks about a way to specify the specific task you want to run, if you want to go that route.
John Diver
11-04-2012, 12:59 AM
I think I read something that running the cron file doesn't run the rssposter though?
I could be wrong but I thought I seen that somewhere.
It is just the RSS poster that I want to run, any way to do it automatically without having to visit the site / run manually would be great :)
Thanks again
--------------- Added 1352054925 at 1352054925 ---------------
I tried what Wayne posted but it isn't posting / updating the feeds.
I set it to every minute, then every 4th (Incase the server did have a problem with running each minute, althought I doubt it)
Still nothing posted.
I tried manually and it worked no problem.
Here is my cron job (Using cPanel)
cd /home/northwes/public_html/world/cron.php; php /home/northwes/public_html/world/cron.php
My user account is northwes and the directory is world and cron is in the root directory as vB is the root of my site.
Am I getting something wrong here?
Thanks!
What's posted in that thread is a little confusing, but the first "cd" part is supposed to be a path to a directory. So maybe try this:
cd /home/northwes/public_html/world/.; php /home/northwes/public_html/world/cron.php
Also that assumes that the "php" program will be in the default path. Do you have any command line access? You might try logging in and entering the command in a shell and see if it runs (maybe log in as the user that cron runs as, if you can determine that).
John Diver
11-05-2012, 02:07 AM
What's posted in that thread is a little confusing, but the first "cd" part is supposed to be a path to a directory. So maybe try this:
cd /home/northwes/public_html/world/.; php /home/northwes/public_html/world/cron.php
Also that assumes that the "php" program will be in the default path. Do you have any command line access? You might try logging in and entering the command in a shell and see if it runs (maybe log in as the user that cron runs as, if you can determine that).
Thanks again for the reply.
I tried that but unfortunately it doesn't work and I am just using a shared account so no command access.
OK, well, hopefully someone else will now why.
Is there any way you could ask your host what the right command would be (to run a php script through cron)? I suspect that the first "cd" part is correct, but it could be that "php" doesn't work unless you explicitly use the path to the php command.
Another thing you might try is "curl" followed by the url (not the file path) of your cron.php file.
John Diver
11-05-2012, 09:42 PM
Hey Kevin,
Would that be like this:
cd /home/northwes/public_html/world/.; curl www.mysite.com/cron.php
Thanks again for helping Kevin :)
You don't need the cd part, so just:
curl www.mysite.com/cron.php
Unfortunately I don't have a linux system where I can try a cron job like that, so I'm just guessing. There could be a path problem trying to use "curl", I don't know.
John Diver
11-10-2012, 02:36 PM
Thanks Kevin!
This seems to be working, but I think it can cause some problems.
What happens if the feeds are being fetched by Rssposter running on the cron while it is already doing the same task?
I.e. just for example, cron is set to run every minute (Because curl /cron.php would only run 1 task at a time, then until for another minute to run the next scheduled task) the RSSposter could be at the bottom of the list, take 5 minutes to run and maybe by the time the cron comes back to the rssposter.php it is still running.
Would that effect it?
Thanks again Kevin!
I think if you set the cronjob to run often enough, you could remove the cron.php image from your footer, then it shouldn't be a problem. But even if you don't it should be OK because it's no different than 2 users loading cron.php at around the same time. I think the scripts are written to handle that.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.