Cron Jobs

In order for Stack CMS to work and help you minimize your manual TCG management, you will need to set up a cron job for it. Cron jobs may be a little bit tricky to those who are not fully familiar with it, so this section will help you out through that hurdle.

What is a cron job?

The cron command-line utility, also known as cron job is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs to run periodically at fixed times, dates, or intervals.

Currently, Stack CMS have 3 sets of cron jobs scripts that you can utilize—daily, weekly and monthly—which you can find inside the /admin folder. These scripts will run any time-period-specific activities that you may need to operate your TCG.

If you have access to cPanel and your host permits you to use cron jobs, then you are good. If you don’t have access to cPanel, you can try to ask your host if they can create them for you. Also, do keep in mind that not all hosts uses cPanel. Some of them may have their own cPanel such as DreamHost. But worry not, I will try my best to discuss the use and creation of cron jobs for both official cPanel and DreamHost panel.

Cron Overview

NOTICE: Please take note of your host's server time before setting up a schedule. If they are different from your local time, you will have to convert your local time to your host's server time in order to setup a correct schedule for your cron.

Weekly Cron Job

The very most important cron job script that you’ll have to use is the weekly cron job. This will run all major updates for your TCG within the past week—new members, new masteries, game updates and the likes. So you don’t want this cron to go off track and for nothing.

Monthly Cron Job

The monthly cron is specifically focused on updating the date of your monthly games updater from the database and the processing of your member of the month activity, should you have it enabled for your TCG.

Daily Cron Job

Lastly is your daily cron job. This cron job mainly focuses on processing user status to inactive, where it checks if the user hasn’t logged in within 60 days, and processing any scheduled blog posts to automatically set it to Published.

NOTE: Do keep in mind that processing scheduled blog posts is best for monthly updates (e.g. if the first day of the month doesn’t fall on your weekly update’s weekday). So if your scheduled blog post is a weekly update, you will have to disable your weekly cron job and manually update new masteries and the likes. Otherwise the weekly cron will duplicate any scheduled blog post for that day.


cPanel Cron Job

So first off, if your host permits the use of cron jobs, scroll down a bit further until you reach the Advanced section of your cPanel as shown in the image below.

Usually, the official cPanel have the same structure of cron job forms. Once you click the link of the cron job from the Advanced section, you will see the following fields. This is where you’re going to set up the schedule for the cron job script that you’re going to use.

Weekly Cron Job

Looking back at the fields above, the only fields that you’re going to set are the Hour, Weekday, and Command fields. You can do so by clicking the dropdown menu of these following fields (– Common Settings –) and choose the schedule of your weekly cron.

Given we will set up our weekly cron at midnight and if local time is same as host server time, we can select the common settings to the following:

Hour: 12:00 a.m. Midnight (0)
Weekday: Friday (5)
Command: /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.weekly.php
NOTE: Make sure to change the absolute path with your own!
You can leave the rest of the fields empty, then click the Add New Cron Job button to save your weekly cron. Once saved, your weekly cron job will look something like this from the list of current cron jobs:

* 0 * * 5 /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.weekly.php

Monthly Cron Job

This is pretty much the same as setting up your weekly cron. The only fields you should be worried about is the Hour, Month and Command fields.

To setup your monthly cron job, given that you have the same time with your host’s server time, you can do so like this:

Hour: 12:00 a.m. Midnight (0)
Month: Every Month (*)
Command: /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.monthly.php

You can leave the rest of the fields empty, then click the Add New Cron Job button to save your monthly cron. Once saved, your monthly cron job will look something like this from the list of current cron jobs:

* 0 * * * /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.monthly.php

Daily Cron Job

To setup your daily cron job, given that you have the same time with your host’s server time, the only fields that you should be worried about are the Hour, Day and Command fields, and you can do so like this:

Hour: Every Hour (*)
Day: Every Day (*)
Command: /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.daily.php

You can leave the rest of the fields empty, then click the Add New Cron Job button to save your daily cron. Once saved, your daily cron job will look something like this from the list of current cron jobs:

* * * * * /usr/local/bin/php /home/user/public_html/TCGSITE/admin/cron.daily.php

DreamHost Cron Job

Next, if you are hosted on DreamHost and you have an access to its web panel, proceed with this tutorial. If you login through the web panel, you will find the Cron Jobs under the More tab from the left sidebar.

The logic is still the same when you use cPanel. Only that DreamHost’s web panel has some other fields such as the User, Title, and Use Locking. You might get a little confused with how the schedule fields aren’t set to blank like that of the cPanel, but don’t worry as it will be overridden with your actual selected schedule.

Once you click the Cron Jobs link, simply click the Add New Cron Job button and you will be directed to the cron job form. Then, select Custom from the drop down of the When to run: field. This will show the rest of the cron fields as shown below.


Again, given if you have the same time as your host’s server time, you can schedule your cron jobs as follows. Als make sure to select your own user in case you have other users who have access to your web panel.

Weekly Cron Job

From the Hours drop down field, select Selected Hours. Another drop down field that lists a 24-hour time format will show up, then select 00. Next, from the Day of Week drop down field, select Selected Days of Week. Like the Hours field, another drop down will show up that lists all seven days of the week, then select your desired weekday for your weekly update.

Hours: 00 (0)
Day of Week: Friday (5)
Command: /usr/local/php73/bin/php /home/user/TCGSITE/admin/cron.weekly.php

Monthly Cron Job

For the monthly cron job, if you have the same time as your host’s server time, you can just select the Monthly option from the drop down of the When to run field. However, if your time is advanced than your host, then you will have to select the Custom option again.

Afterwards, from the Hours field, select the time of your host that will reflect midnight of your local time when converted. As for the Day of Month field, this may get a little tricky since not all months have 30th and 31st in them.

I haven’t tried using the monthly cron on DreamHost yet, so I’m not entirely sure how this will affect the run time. The best thing you can do to be sure about it is to contact their support team. DreamHost’s support is very responsive and helpful, so you won’t have any problem consulting them directly.

Do not forget to fill up the Title and the Command fields! Also please take note of the /usr/local/php73/bin/php line. You must change the php73 to the PHP version that you are using for your site.

You can leave the rest of the fields empty, then click the Add button to save your cron jobs.