This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running app on startup
#1
Hello, guys!
I tried to run my C++ application on startup, without success. It runs, if I start it in terminal, but not accepted to run on startup.
I tried to run it as service, and tried run it from startup directory.
What is a right way to do it on Thinker board Debian?
Thank you.
Reply
#2
Ok I found some way to run app on startup
1. In dir /etc/systemd/system write file startApp.service
2. Save file and Start Service: sudo service startApp start

==== file: startApp.service ============
[Unit]
Description=Start the Streamer app on system boot
After=syslog.target network.target
[Service]
User=root
Type=simple
WorkingDirectory=/home/linaro/MyDir
ExecStart=/home/linaro/Projects/App
[Install]
WantedBy=multi-user.target

Different from Raspberry @ Beagle Bone, here we need to specify
WorkingDirectory , User and path to binary file.

That's all.
Reply
#3
Start Bash on Unbutu on Windows and run the following command to open the Nano program (text editor on Linux).
Nano program interface appears, proceed to edit the code for the program:

#include <stdio.h>
int main ()
{
      printf ("Hello World");
      return 0;
}
The interface of the program written in Nano will be as follows
After editing the program, use Ctrl + O (Write Out) to save the program.

Or if Ctrl + X (Exit Section), Nano will ask if you want to save or not?

Name the program file Text.c (must also set the file extension .c or .cpp) and save.
To execute Test.c we will compile Test.c into a file in .obj format. We exit the Nano program by pressing Ctrl + X and go back to the Linux console, where I use the following command to compile Test.c into Test.o (.o means .obj)

gcc -c Test.c -o Test.o
After compilation is complete, use the ls command to check which files exist in the current directory

Next, link Test.o to executable file (this file is similar to .exe file of Windows environment) with the following command

gcc -o program Test.o
With program is the name of the executable file I set.

After the link is complete, use the ls command to check the list of files present in the current directory.
Finally, to execute the program the program uses the following command

./program
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)