Little script to check wether SuiteCRM is running or not

What is the most efficient way to test whether SuiteCRM is online? The thing is that I want to curl the script to check the status of the page. For example: curl http://suitecrm.de/status.php

if(!defined('sugarEntry')) define('sugarEntry', true);
require_once 'include/entryPoint.php';

$status = (BeanFactory::getBean('Accounts')) ? "online" : "offline";

echo $status; die;

The response is only “online” if the website is up and running. In all other cases, the response will be different.

Can you think of a better/more performant way to check this? Thanks!

Interesting question. :thinking:

I guess it is useful to do some database access so that you get the confirmation that the DB is also ok (not just the web server responding to your request).

For that purpose, I am not sure if getBean is the best confirmation, I’d have to look into the code to see exactly what it does. A simple option would be to use direct SQL to run a very performant simple query.

There are discussions online about this

Very good point! I checked it. When I stop the Docker Database Container, the script throws an error. So it does call the database in some way.

For my specific use case I do not need to know if the database is up and running, only SuiteCRM.
So if anyone finds a more efficient way to check this, please let me know.

Thank you :slight_smile: