Restart 3CX 18 Services from Debian Command Line

I have a 3CX server running on a small Azure B1ls virtual machine, 1 vCPU, 0.5 GiB RAM. This has been working fine for years. I recently did an apt update/apt upgrade on the machine. That in turn upgraded 3CX to v18 Update 8 (Build 917), which I had not intended to do. The latest version must be using more resources, because after a reboot, not all 3CX services start. I had the 3CX dashboard GUI (web site) working at one point, then it was only displaying Server Error, so I could not access the dashboard.

I logged in to the machine via SSH and saw that part of the problem is that the Azure waagent chews up quite a bit of the CPU even when the machine is idle. To check this (thanks to this post), run top, get the PID of the python3 process, then check the associated command line, e.g. for PID 832, run /cat /proc/832/cmdline:

3CX Services 04

The following command confirmed that some 3CX services had failed to start due to a timeout. (Note that all Linux commands are case-sensitive!)

systemctl status 3CX*

3CX Services 01

Since that was after a reboot, I wanted to try to stop and start the services directly. This post on the 3CX forum pointed to the commands to use to stop and start the services:

sudo 3CXStopServices
sudo 3CXStartServices

3CX Services 02

systemctl status 3CX* confirms that all the services are now running:

3CX Services 03

With all services running, calls are working, but the dashboard is still displaying Server Error and the web client reports 504 Gateway timeout.

I decided to try stopping the Azure agent to see if I could access the dashboard

sudo systemctl stop walinuxagent

Yep, after that stopped, the python3 service was gone and the 3CX dashboard and 3CX web client were able to load, albeit quite slowly. Of course, with the Azure agent stopped, some Azure services won’t work (like accessing the CLI from the Azure dashboard and maybe backups).

To continue with 3CX, I’ll have to upgrade to a larger Azure machine. I decided to try a B1s machine with 1 vCPU and 1 GiB of RAM. It took maybe five minutes for Azure to resize the machine. All 3CX services started; python3 is running but not using much CPU; the 3CX dashboard and web client start quickly. Even SSH access feels snappier. top shows most of the 1 GiB in use, but not much swap:

3CX Services 05
After the upgrade, resource usage was enough higher that swapping memory was probably bogging down the 0.5 GiB machine. It seems much happier with 1 GiB.

3CX Services List

If you need a list of services to create a script from, I found one in this post with a list of services (here checking if they are enabled). It’s probably better to use the 3CXStop/StartServices commands, as they may may manage services in a particular order, but I’ll include the list of services for reference:

systemctl is-enabled 3CXIVR01.service
systemctl is-enabled 3CXPhoneSystem01.service
systemctl is-enabled 3CXMediaServer.service
systemctl is-enabled 3CXCallFlow01.service
systemctl is-enabled 3CXFirewall.service
systemctl is-enabled 3CXAudioProvider01.service
systemctl is-enabled 3CXCfgServ01.service
systemctl is-enabled 3CXEventNotificationManager.service
systemctl is-enabled 3CXSystemService01.service
systemctl is-enabled 3CXGatewayService.service
systemctl is-enabled 3CXPhoneSystemMC01.service
systemctl is-enabled 3CXQueueManager01.service
systemctl is-enabled nginx.service

1 thought on “Restart 3CX 18 Services from Debian Command Line

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.