Yocto startup scripts systemd: Difference between revisions

From embeddedTS Manuals
(Created page with "To have your headless application start up on poweron you need to create a service. Create a file in /etc/systemd/system/yourapp.service <source lang=ini> [Unit] Description=...")
 
No edit summary
Line 23: Line 23:


{{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:
/etc/X11/xinit/xinitrc
At the end of the script replace xterm with your application:
<source lang=bash>
exec xterm -geometry 80x66+0+0 -name login
</source>
Keep the exec statement before your application.  If your process ends then X11 will stop with it.

Revision as of 10:04, 15 October 2015

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

The multi-user.target will start up early, but if you depend on networking you should use "network.service". Once you have this file in place add it to startup with:

# Start your app automatically 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 you should modify the file: /etc/X11/xinit/xinitrc

At the end of the script replace xterm with your application:

exec xterm -geometry 80x66+0+0 -name login

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