I want to launch hello_world example Linux application when Linux system boot.
How to do that ?
Thanks
I want to launch hello_world example Linux application when Linux system boot.
How to do that ?
Thanks
You probably want to do this when the user logs in, not when the system boots. If you’re using the Altera GSRD, look at adding/modifying ~/.profile to run your application.
Thank you.
refer to link: http://stackoverflow.com/questions/14149477/auto-start-program-at-login-in-angstrom-on-beagleboard
Found the answer: The script /etc/profile is ran when the user logs in.
You can add a line to start your application at the end it.
The /etc/rc.local script can be used for launch application without logging in.
It’s a better option.
root@socfpga:~# systemctl -l status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-09-22 18:57:09 UTC; 1min 13s ago
Process: 1283 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)
Sep 22 18:57:08 socfpga systemd[1]: Starting /etc/rc.local Compatibility…
Sep 22 18:57:09 socfpga systemd[1]: rc-local.service: Control process exited, code=exited status=203
Sep 22 18:57:09 socfpga systemd[1]: Failed to start /etc/rc.local Compatibility.
Sep 22 18:57:09 socfpga systemd[1]: rc-local.service: Unit entered failed state.
Sep 22 18:57:09 socfpga systemd[1]: rc-local.service: Failed with result ‘exit-code’.
root@socfpga:~#
Run applications as services on startup:
In order to run an application as a service on startup, create a file named “.service” in the folder “/etc/systemd/system/” with the following contents:
[Unit]
Description=Service description
After=network.target
[Service]
User=
Group=
ExecStart=
Restart=always
[Install]
WantedBy=multi-user.target
Example running a python application called triangle-detector-server.py:
[Unit]
Description=Triangle Detector Server
[Service]
Type=simple
WorkingDirectory=/home/root/triangle-detector-server
ExecStart=/home/root/.virtualenvs/uvicamera/bin/python triangle-detector-server.py
[Install]
WantedBy=multi-user.target
I have this working but i needed to add the service to startup after doing this.
just type systemctl enable xxxx.service
xxxx = name of your service