Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| en:general_information:tutorial:autostart [2016/06/10 08:55] – removed liedmann | en:general_information:tutorial:autostart [2025/01/28 11:17] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ++++ How to autostart application with systemd | | ||
| + | ==== Example for creating Qt application autostart on TQMa6x BSP ==== | ||
| + | |||
| + | |||
| + | 1. Create file **/ | ||
| + | < | ||
| + | [Unit] | ||
| + | After=multi-user.target | ||
| + | Description=start Qt demo | ||
| + | |||
| + | [Service] | ||
| + | Type=forking | ||
| + | RemainAfterExit=no | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target.wants | ||
| + | </ | ||
| + | 2. Create file **/ | ||
| + | < | ||
| + | #!/bin/sh | ||
| + | |||
| + | case " | ||
| + | start) | ||
| + | echo 0 > / | ||
| + | / | ||
| + | ;; | ||
| + | stop) | ||
| + | killall touchinteraction | ||
| + | ;; | ||
| + | *) | ||
| + | echo " | ||
| + | exit 1 | ||
| + | ;; | ||
| + | esac | ||
| + | </ | ||
| + | 3. make system-demo executable.\\ | ||
| + | 4. create symlink demo.service in **/ | ||
| + | < | ||
| + | cd / | ||
| + | ln -s / | ||
| + | </ | ||
| + | ++++ | ||
| + | ++++ How to autostart application with initd | | ||
| + | |||
| + | 1. Move to **/ | ||
| + | < | ||
| + | nano / | ||
| + | </ | ||
| + | 2. Use the following command to make the script executable. | ||
| + | < | ||
| + | chmod +x startscript | ||
| + | </ | ||
| + | 3. Create a symlink to the script in **/ | ||
| + | < | ||
| + | ln -s / | ||
| + | </ | ||
| + | ++++ | ||