Vtiger Cronjobs & Automation

Vtiger is a great way to track, interact and categorize your data. Once you have all of this data at your fingertips you now need a way to generate reports, sync data etc. So how do you automate some of these processes to save clicks or continue the stream of data? Since you’re reading this article, you likely already know that your next step is to use cron jobs.

Vtiger itself requires a cron job to execute a wide range of default automation. For this article we’ll discuss adding a cron job for a Boru Vtiger Module, specifically Vtiger Google Contact Sync.

Step 1 – Identify your server OS

Setting up a cron job can be different depending on your Vtiger’s server Operating System. You will need to determine if your host is a Windows server or a Linux server.

Step 2 – What is your command line?

In order to trigger the automation you will have to know what files handle the task that you wish to automate. In this case for Google Contacts Sync you will need to add two cron job lines. One for sending to Google and one for receiving from Google Contacts.

  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]YOURVTIGERCRMDIR/modules/ContactSync/syncContactFromGA.php[/highlight]
  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]YOURVTIGERCRMDIR/modules/ContactSync/syncContactFromVT.php[/highlight]

Setting up the Cron Job if you use Linux

The instructions here will vary based on the distribution you are using. You may experience different results, we’re happy to assist so please don’t hesitate to contact us.

You will need to edit the cron tab. Use your editor of choice to open the cron tab file, here are some possible methods (you will need root access to the server):

  1. crontab -e
  2. nano /etc/crontab
  3. pico /etc/crontab
  4. vi /etc/crontab

Now add your cron job lines. For our Google Contact Sync you will likely want it to automatically sync every 30 minutes.

  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * root php -f YOURVTIGERCRMDIR/modules/ContactSync/syncContactFromGA.php[/highlight]
  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * root php -f YOURVTIGERCRMDIR/modules/ContactSync/syncContactFromVT.php[/highlight]

Save and exit the crontab file.

If you’re on a shared server and the PHP version for command line is different than the PHP version for your web then you can use these command lines:

  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * root wget -q –spider http://PATHTOVTIGER/modules/CalendarSync/actions/syncCalendarFromGA.ph[/highlight]
  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * root wget -q –spider http://PATHTOVTIGER/modules/ContactSync/syncContactFromVT.php[/highlight]

 

Setting up the Cron Job if you are hosting on a cPanel server

You will need to navigate to the Cron Jobs within cpanel. This section tends to be at the bottom of the cPanel settings page. Look for this icon:

cpanel_cron_jobs

On the next screen you have timing settings for choosing when your script will run. The command line argument is a little different as you will not need to proceed the text with “root.” Here is what the command line argument would look like in cPanel:

  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]php -f YOURVTIGERCRMDIR/modules/ContactSync/syncContactFromGA[/highlight]

 

cpanel_cron_jobs2

 

It’s possible you will need to use the wget command depending on  your host’s settings. This is a possible example:

 

  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * wget -q –spider http://PATHTOVTIGER/modules/CalendarSync/actions/syncCalendarFromGA.ph[/highlight]
  • [highlight background_color=”#A4B5C4″ color=”#FFFFF”]30 * * * * wget -q –spider http://PATHTOVTIGER/modules/ContactSync/syncContactFromVT.php[/highlight]

It’s also possible your host has wget restrictions and then you will need to use User Agent command arguments. Here are some possible examples:

  • curl –user-agent YOUR_STRING (URL)
  • lynx -dump -useragent=YOUR_STRING (URL)

Example:

/usr/bin/curl --user-agent cPanel-Cron http://PATHTOVTIGER/modules/ContactSync/syncContactFromVT.php

 

Setting up the Cron Job if you are hosting on a Windows Server

If you are running windows then there is really no reason for us to show how to do this again as Vtiger has done a nice write up on this already. You can find their write up at this link: https://wiki.vtiger.com/index.php/Cron

There you have it. Setting up a cron job only sounds intimidating, it’s quite easy to do but as always, there are a lot of different systems out there and sometimes what seems easy needs just a little assistance. We can provide Vtiger support for almost any operating system. We’ve even assisted full installation on Synology NAS. Let us know how we can assist.

[button color=”custom” size=”default” light=”no” icon=”fa-comments” open_in_new_window=”yes” link=”https://www.boruapps.com/contact-us/ “]Contact Us[/button]

Interested in learning more? Let us send you an email.

Recent Blogs

Popular Blogs