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

Summary of common tool functions necessary for front-end development

1. Time formatting and other methods It is recomm...

How to authorize all the contents of a folder to a certain user in Linux?

【Problem Analysis】 We can use the chown command. ...

css add scroll to div and hide the scroll bar

CSS adds scrolling to div and hides the scroll ba...

Solve the scroll-view line break problem of WeChat applet

Today, when I was writing a small program, I used...

Detailed installation and configuration of MySql on Mac

1. Download and install Download the community ed...

MySQL group query optimization method

MySQL handles GROUP BY and DISTINCT queries simil...

Configure Mysql master-slave service implementation example

Configure Mysql master-slave service implementati...

Detailed explanation of the solution to docker-compose being too slow

There is only one solution, that is to change the...

In-depth understanding of javascript prototype and prototype chain

Table of contents 1. What is a prototype? 2. Prot...

How to add ansible service in alpine image

Use apk add ansible to add the ansible service to...

In-depth understanding of the matching logic of Server and Location in Nginx

Server matching logic When Nginx decides which se...

Element avatar upload practice

This article uses the element official website an...

JS implements user registration interface function

This article example shares the specific code of ...

Use javascript to create dynamic QQ registration page

Table of contents 1. Introduction 1. Basic layout...