Being able to set up timed content on your ocPortal website is possibly something you will want to do at some point during your website’s lifespan. This might be so you can schedule content to go live while you are away, or in the case of a news site you may have an embargo on news until a specific time.
The first task is you need to do is known as “setting up a cron job”. To do this you will need to log in to your Arvixe web hosting Cpanel.
Once you have logged into Cpanel scroll down to the advanced section which is the second last section in the standard Cpanel on Arvixe hosting. Click on the “Cron Jobs” option which will take you to a screen which will have a section which looks like this:
To set up the cron job you need to fill in all of the options. Depending on how regularly you will want to post scheduled content will determine what setting s you use in this section. You can set cron to run as often as you like from once every minute to once a month. In most cases once every 5 minutes will be more than adequate. To set this you need to input */5 in the minute box which is every 5 minutes. If this was */7 it would run every 7 minutes. You also need to fill in the hour, day month and weekday options. As you want it to run every hour, every day, every month and every weekday you need to pu “*” in each of these boxes.
If you want the cron to run very minute put “*” in all of the boxes or choose the every 1 minute option in the common settings.
The last part of this section of the tutorial is filling in the command box. In this box you need to tell cron to call the file which will tell ocPortal to check for scheduled content. In ocPortal the file is “cron_bridge.php and it is located in the data directory. So the command line will look something like this:
The php is telling cron it is calling a php file and the second part is the address to the file within your hosting. You can find the first part by looking at the stats section of your cpanel home screen which will tell you your home directory. The next part “Public_html” is where your root directory of your web hosting files will be and the “data/cron_bridge.php” is the address of the file within your hosting. If you have not installed your ocPortal website on the root of your hosting you will need to add the directory of the website into the command line too.
For example if your website is installed into a “WEB” directory then the command line would be:
Once you have filled this in you can click the “Add new Cron job” button.
This will now instruct Cron to call the file at the designated time. I have noticed this can sometimes take an hour or two to kick in to be patient.
Once this is up and running you should see options to schedule a post within the advanced section of when you add a new news post for example. Once this appears you will know your Cron is running correctly. The option will look like this:
You will also need to make sure you have the website time settings correct otherwise the article may not appear at the correct time.