How to setup your cronjobs

What is a cronjob?
A cron job is an automated program developed for Unix and Linux systems. It allows the user to execute several commands at a specific time on a precise date. A cron job is an important tool that can be used for anything from running scripts and re-indexing a web page to providing backup for a database.

Why do you need a cronjob?
JAVS use cronjob to schedule the time a video is encoded.

Example1: Every 15 minutes a user upload a video and you set your cron job to check every 10 minutes if there is a video that need to be encoded. If it’s a big video and the progress time takes longer then 15 minuites it will wait with encoding the next file. This will help your server to spread the load of a encoding progress. You can set the number of simultaneously encodes and maybe only encode video at night when there are less users watching your website.

Example2: When you have turned on the option of server 2 server a cronjob checks if it need to download a video file and add it to the encoding queue. You can download a video every 10 minutes and set the maximun download threads at once.

Step 1:

Login to your admin panel at your website and go to Site Settings  -> Tab Encoding.
On the tab encoding you see some options like cron password, max encoding, max download, and the cronjob commands.

Password for cron jobs You have entered this password in the install script but here can alter it. Don’t forget to change your cronjob as well.
Max number of encode progresses Maximum number of simultaneously video encoding threads
Max number of download progresses Maximum number of simultaneously video downloading  threads.
(if Server 2Server is diabled this isn’t needed)

Step 2:

The cronjob command you have to set can be found on the tab Encoding as well.
Cronjob command for encoding <- This is the command to add for the encoding progress.
Cronjob command for downloading S2S <- This is the command to add for the downloading progress of the server 2 server option.
Cronjob Command for Cleaning Database <- This command cleans up the database.

Instead of using php to execute the script we could use curl.

Cronjob encoding every 15 minutes
Cronjob downloading every 15 minutes
Cronjob cleaning up database every 24 hours.

Step 3:

How to setup cronjob in Cpanel
How to setup cronjob in DirectAdmin
How to setup cronjob in Plesk
How to setup cronjob in Shell Bash

Leave a comment

You must be logged in to post a comment.