This is an old revision of the document!


How to autostart application

1.Create file /etc/systemd/qtdemo.service with following content :

[UNIT]
Description=Start Multitouch Qt Demo

[SERVICE]

[Install]
WantedBy=multi-user.target

2.Create file lib/systemd/system/demo.service with following content :

[Unit]
After=multi-user.target
Description=start Qt demo

[Service]
Type=forking
RemainAfterExit=no
ExecStart=/lib/systemd/systemd-demo start
ExecStop=/lib/systemd/systemd-demo stop

[Install]
WantedBy=multi-user.target.wants

3. Create file /lib/systemd/systemd-demo with following content :

#!/bin/sh

case "$1" in
        start)
                echo 0 > /sys/class/graphics/fbcon/cursor_blink
                /usr/bin/qt5-examples/quick/touchinteraction/touchinteraction
                ;;
        stop)
                killall touchinteraction
                ;;
        *)
                echo "usage: $0 [start|stop]"
                exit 1
                ;;
esac

4. make system-demo executable.
5. create symlink demo.service in /etc/system/system/multi-user.target.wants that points to the file /lib/systemd/system/demo.service :

cd /etc/systemd/system/multi-user.target.wants/
ln -s /lib/systemd/system/demo.service demo.service
  • Last modified: 2022/08/04 15:04