Yocto startup scripts systemd: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 15: Line 15:
<source lang=bash>
<source lang=bash>


# Start your app automatically on bootup, but will not start it now
# Start your app on bootup, but will not start it now
systemctl enable yourapp.service
systemctl enable yourapp.service


Line 24: Line 24:
{{Note|See the [http://www.freedesktop.org/software/systemd/man/systemd.service.html systemd documentation] for in depth documentation on services.}}
{{Note|See the [http://www.freedesktop.org/software/systemd/man/systemd.service.html systemd documentation] for in depth documentation on services.}}


To have a graphical application startup you should modify the file:
To have a graphical application startup change the file:
/usr/bin/mini-x-session
/usr/bin/mini-x-session



Revision as of 16:24, 10 February 2017

To have your headless application start up on poweron you need to create a service. Create a file in /etc/systemd/system/yourapp.service

[Unit]
Description=Run an application on the i.MX6

[Service]
Type=simple
ExecStart=/usr/local/bin/your_app_or_script

[Install]
WantedBy=multi-user.target

If you depend on networking you should add "After=network.target" in the Unit section. Once you have this file in place add it to startup with:

# Start your app on bootup, but will not start it now
systemctl enable yourapp.service

# Start your app now, but doesn't change auto startup
systemctl start yourapp.service
Note: See the systemd documentation for in depth documentation on services.

To have a graphical application startup change the file: /usr/bin/mini-x-session

At the end of the script replace matchbox-terminal with your application:

matchbox-terminal&
exec matchbox-window-manager

Keep the exec statement before your application. If your process ends then X11 will stop with it.