Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize embedded Linux restart QT Application

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to achieve embedded Linux restart QT applications, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Applications generally have the following business requirements:

When there is a new version of APP, the program needs to perform an update, and after the update is completed (most of the so-called updates are overwritten), there is no need to shut down, but the application can restart itself.

Checked some information on the Internet, the description is very complex, it is better to create a script, batch processing to complete my work is so simple, fast and rough.

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

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/shkillall-9 my_appecho "restart my_app!" # close backlightecho 0 > / sys/class/backlight/backlight/brightness/opt/app/my_app-qws-nomouse-font wqy-microhei &

When the script is executed, killall-9 my_app is first called to shut down the currently ongoing process with the same name as my app, then turn off the backlight and let LCD go out, and finally, restart app and leave app running in the background.

In this way, the restart action of app is simply completed.

These are all the contents of the article "how to restart QT applications with embedded Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report