A simple way to restart QT application in embedded Linux (based on QT4.8 qws)

A simple way to restart QT application in embedded Linux (based on QT4.8 qws)

Application software generally has such business requirements:

When a new version of the APP is available, the program needs to be updated. After the update is completed (the so-called update is mostly in the form of overwriting), there is no need to shut down the computer, but the application can restart itself.

I checked some information online, but the descriptions were very complicated. It would be simpler, faster and more brutal to create a script to complete my work in batches.

In the program, you can restart through QT's thread library function, or you can simply call an external script to complete the restart work.

qApp->closeAllWindows();
system("/opt/app/restart_app.sh");

As you can see here, restart_app.sh is an external script.

The external script contains the following:

#!/bin/sh
killall -9 my_app
echo "restart my_app!"
#close backlight
echo 0 > /sys/class/backlight/backlight/brightness
/opt/app/my_app -qws -nomouse -font wqy-microhei &

When the script is executed, it will first call killall -9 my_app to close the current process with the same name as my app, then turn off the backlight and turn off the LCD. Finally, restart the app and run it in the background.

This simply completes the restart of the app.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to configure the Qt development environment of the Go language on Ubuntu Linux
  • Solve the problem of using linuxdeployqt to package Qt programs in Ubuntu
  • How to remotely batch execute Linux command programs using pyqt
  • How to use Qt to connect to MySQL database under ubuntu linux
  • How to install subversion 1.9.5 in Linux environment (CentOS 6.7 64-bit)
  • Solution to Linux QT Kit missing and Version empty problem

<<:  Vue implements countdown function

>>:  Diagram of the process from uninstallation to installation of MySQL 5.7.18 yum under Linux

Recommend

Implementation of MYSQL (telephone number, ID card) data desensitization

1. Data desensitization explanation In daily deve...

Example of using Nginx reverse proxy to go-fastdfs

background go-fastdfs is a distributed file syste...

How to monitor Tomcat using LambdaProbe

Introduction: Lambda Probe (formerly known as Tom...

Detailed description of component-based front-end development process

Background <br />Students who work on the fr...

Detailed explanation of how to access MySQL database remotely through Workbench

Preface Workbench is installed on one computer, a...

Vue example code using transition component animation effect

Transition document address defines a background ...

How to install MySQL under Linux (yum and source code compilation)

Here are two ways to install MySQL under Linux: y...

MySQL full backup and quick recovery methods

A simple MySQL full backup script that backs up t...

Example code for css flex layout with automatic line wrapping

To create a flex container, simply add a display:...

Recommend 60 paging cases and good practices

<br />Structure and hierarchy reduce complex...

Vue component to realize carousel animation

This article example shares the specific code of ...