I found myself in possession of a modem by Quectel (https://www.quectel.com) to hook up to a Raspberry Pi running Ubuntu 20.04. I wanted to auto run Quectel's connection manager executable quectel-CM on system start up but found limited information available online from Quectel. So I had to roll up my sleeves and make my own systemd service for that purpose.
This post outlines the steps I took:
Download and compile the quectel-CM executable
- Using an Internet browser, download the latest Quectel LTE, 5G Linux USB driver, e.g. Quectel_LTE5G_Linux_USB_Driver_V1.0.zip from https://www.quectel.com/download-zone.
- Extract QConnectManager_Linux_V1.0.zip into a folder e.g. /home/ubuntu/Downloads/quectel-CM/.
- In a Terminal, change directory to the extracted folder.
$ cd ~/Downloads/quectel-CM/ - Use the make command to compile the connection manager executable.
$ make
The quectel-CM executable is compiled.
Place the quectel-CM exe to the run time directory
- In a Terminal, type in the following commands to change directory to the extracted directory.
$ cd /home/ubuntu/Downloads/quectel-CM/ - Copy the executable to /usr/local/bin/.
$ sudo cp quectel-CM /usr/local/bin
Create a systemd service file
- In the directory /etc/systemd/system, use a text editor to create a service file e.g. quectelcm.service.
$ sudo vi /etc/systemd/system/quectelcm.service - Type in the following lines, save and exit the file:
[Unit] Description=Systemd service for running Quectel's Connection Manager quectel-CM executable [Service] ExecStart=/usr/local/bin/quectel-CM Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
- Give the service file the following executable permission:
$ sudo chmod 664 /etc/systemd/system/quectelcm.service
Create the service
- In the Terminal, type in the following commands:
$ sudo systemctl daemon-reload
$ sudo systemctl enable quectelcm
The quectelcm service is created.
Running and monitoring the service
- You can either reboot the Raspberry Pi or type in the following command to start the service in a Terminal.
$ sudo systemctl start quectelcm - To monitor the quectelcm service, use the journalctl command:
$ journalctl -u quectelcm -f
Note: In order for quectel-CM to request and set the machine's network address, the software prerequisites net-tools and udhcpc must be installed on the Raspberry Pi.
No comments:
Post a Comment