Where should I put my C++ program to run at startup? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I am trying my Ubuntu-Server launches my program after boot, so I put my program's executable file address on /etc/rc.local followed by space+& like this:



/home/m/myapp &


But it didn't work!
My program is a simple C++ code that uses gtk+ library to show an image and it works when I run it manually. But I want it runs automatically at the startup, but don't know how?



EDIT: I want to make a simple purpose computer. Actually it's a robot that it's program is written in C++ and it's executable is on /home/m/myapp. Also I do not like to have login page. There is no user menu or ability to controll the system. So it must run after boot automatically.



If I want to explain more, the system should exactly work like this:




When user turns on the system, it shows a welcome picture, then it
waits until the user says a voice command. then it recognizes the
voice, shows an image/video related to the voice, then shows the
welcome picture again and waits for new command.



There is no menu, no
login page and nothing for user. this system only works by user
command as I said above!




So as I am new to Linux, I don't know is it a background program or not? And how can I do this?







share|improve this question














closed as unclear what you're asking by G-Man, Alexander, Jeff Schaller, Archemar, Raphael Ahrens Nov 6 '17 at 11:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
    – Alexander
    Nov 6 '17 at 9:11










  • @Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
    – user145959
    Nov 6 '17 at 18:29










  • probably should be changing the login manager to one that doesn't require login, eg "nodm"
    – Jasen
    Nov 7 '17 at 2:22










  • @Jasen: what's the difference between login manager and background service?
    – user145959
    Nov 7 '17 at 6:08










  • Why you do not open my question?
    – user145959
    Nov 9 '17 at 19:07














up vote
2
down vote

favorite












I am trying my Ubuntu-Server launches my program after boot, so I put my program's executable file address on /etc/rc.local followed by space+& like this:



/home/m/myapp &


But it didn't work!
My program is a simple C++ code that uses gtk+ library to show an image and it works when I run it manually. But I want it runs automatically at the startup, but don't know how?



EDIT: I want to make a simple purpose computer. Actually it's a robot that it's program is written in C++ and it's executable is on /home/m/myapp. Also I do not like to have login page. There is no user menu or ability to controll the system. So it must run after boot automatically.



If I want to explain more, the system should exactly work like this:




When user turns on the system, it shows a welcome picture, then it
waits until the user says a voice command. then it recognizes the
voice, shows an image/video related to the voice, then shows the
welcome picture again and waits for new command.



There is no menu, no
login page and nothing for user. this system only works by user
command as I said above!




So as I am new to Linux, I don't know is it a background program or not? And how can I do this?







share|improve this question














closed as unclear what you're asking by G-Man, Alexander, Jeff Schaller, Archemar, Raphael Ahrens Nov 6 '17 at 11:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
    – Alexander
    Nov 6 '17 at 9:11










  • @Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
    – user145959
    Nov 6 '17 at 18:29










  • probably should be changing the login manager to one that doesn't require login, eg "nodm"
    – Jasen
    Nov 7 '17 at 2:22










  • @Jasen: what's the difference between login manager and background service?
    – user145959
    Nov 7 '17 at 6:08










  • Why you do not open my question?
    – user145959
    Nov 9 '17 at 19:07












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am trying my Ubuntu-Server launches my program after boot, so I put my program's executable file address on /etc/rc.local followed by space+& like this:



/home/m/myapp &


But it didn't work!
My program is a simple C++ code that uses gtk+ library to show an image and it works when I run it manually. But I want it runs automatically at the startup, but don't know how?



EDIT: I want to make a simple purpose computer. Actually it's a robot that it's program is written in C++ and it's executable is on /home/m/myapp. Also I do not like to have login page. There is no user menu or ability to controll the system. So it must run after boot automatically.



If I want to explain more, the system should exactly work like this:




When user turns on the system, it shows a welcome picture, then it
waits until the user says a voice command. then it recognizes the
voice, shows an image/video related to the voice, then shows the
welcome picture again and waits for new command.



There is no menu, no
login page and nothing for user. this system only works by user
command as I said above!




So as I am new to Linux, I don't know is it a background program or not? And how can I do this?







share|improve this question














I am trying my Ubuntu-Server launches my program after boot, so I put my program's executable file address on /etc/rc.local followed by space+& like this:



/home/m/myapp &


But it didn't work!
My program is a simple C++ code that uses gtk+ library to show an image and it works when I run it manually. But I want it runs automatically at the startup, but don't know how?



EDIT: I want to make a simple purpose computer. Actually it's a robot that it's program is written in C++ and it's executable is on /home/m/myapp. Also I do not like to have login page. There is no user menu or ability to controll the system. So it must run after boot automatically.



If I want to explain more, the system should exactly work like this:




When user turns on the system, it shows a welcome picture, then it
waits until the user says a voice command. then it recognizes the
voice, shows an image/video related to the voice, then shows the
welcome picture again and waits for new command.



There is no menu, no
login page and nothing for user. this system only works by user
command as I said above!




So as I am new to Linux, I don't know is it a background program or not? And how can I do this?









share|improve this question













share|improve this question




share|improve this question








edited Nov 9 '17 at 19:13

























asked Nov 6 '17 at 7:07









user145959

126112




126112




closed as unclear what you're asking by G-Man, Alexander, Jeff Schaller, Archemar, Raphael Ahrens Nov 6 '17 at 11:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by G-Man, Alexander, Jeff Schaller, Archemar, Raphael Ahrens Nov 6 '17 at 11:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2




    Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
    – Alexander
    Nov 6 '17 at 9:11










  • @Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
    – user145959
    Nov 6 '17 at 18:29










  • probably should be changing the login manager to one that doesn't require login, eg "nodm"
    – Jasen
    Nov 7 '17 at 2:22










  • @Jasen: what's the difference between login manager and background service?
    – user145959
    Nov 7 '17 at 6:08










  • Why you do not open my question?
    – user145959
    Nov 9 '17 at 19:07












  • 2




    Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
    – Alexander
    Nov 6 '17 at 9:11










  • @Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
    – user145959
    Nov 6 '17 at 18:29










  • probably should be changing the login manager to one that doesn't require login, eg "nodm"
    – Jasen
    Nov 7 '17 at 2:22










  • @Jasen: what's the difference between login manager and background service?
    – user145959
    Nov 7 '17 at 6:08










  • Why you do not open my question?
    – user145959
    Nov 9 '17 at 19:07







2




2




Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
– Alexander
Nov 6 '17 at 9:11




Do you want it to start when you log in, or as a service in the background when the system boots? If you want it to start when you log in, it depends on which windowmanager you use.
– Alexander
Nov 6 '17 at 9:11












@Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
– user145959
Nov 6 '17 at 18:29




@Alexander: I want to build a robot that uses Linux. So I think it should be something in background that executes without need to login.
– user145959
Nov 6 '17 at 18:29












probably should be changing the login manager to one that doesn't require login, eg "nodm"
– Jasen
Nov 7 '17 at 2:22




probably should be changing the login manager to one that doesn't require login, eg "nodm"
– Jasen
Nov 7 '17 at 2:22












@Jasen: what's the difference between login manager and background service?
– user145959
Nov 7 '17 at 6:08




@Jasen: what's the difference between login manager and background service?
– user145959
Nov 7 '17 at 6:08












Why you do not open my question?
– user145959
Nov 9 '17 at 19:07




Why you do not open my question?
– user145959
Nov 9 '17 at 19:07










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










GTK requires X, without X your program cannot display an image.



if you want it to run in the context of the login manager add it to the login manager's desktop environment. (this was /var/lib/something last time I looked at ubuntu)



else you can replace the login manager with a non-interactive one like 'nodm', which will open toyr session automatically and then just add your c++ app to your session's startup applications.



I'm not sure where you add applications to autostart in openbox, but ~/.xsession always works.



create a ~/.xsession file that does yourapp& and then openbox-session (see the man page for xinit)






share|improve this answer






















  • Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
    – user145959
    Nov 6 '17 at 18:37

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










GTK requires X, without X your program cannot display an image.



if you want it to run in the context of the login manager add it to the login manager's desktop environment. (this was /var/lib/something last time I looked at ubuntu)



else you can replace the login manager with a non-interactive one like 'nodm', which will open toyr session automatically and then just add your c++ app to your session's startup applications.



I'm not sure where you add applications to autostart in openbox, but ~/.xsession always works.



create a ~/.xsession file that does yourapp& and then openbox-session (see the man page for xinit)






share|improve this answer






















  • Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
    – user145959
    Nov 6 '17 at 18:37














up vote
2
down vote



accepted










GTK requires X, without X your program cannot display an image.



if you want it to run in the context of the login manager add it to the login manager's desktop environment. (this was /var/lib/something last time I looked at ubuntu)



else you can replace the login manager with a non-interactive one like 'nodm', which will open toyr session automatically and then just add your c++ app to your session's startup applications.



I'm not sure where you add applications to autostart in openbox, but ~/.xsession always works.



create a ~/.xsession file that does yourapp& and then openbox-session (see the man page for xinit)






share|improve this answer






















  • Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
    – user145959
    Nov 6 '17 at 18:37












up vote
2
down vote



accepted







up vote
2
down vote



accepted






GTK requires X, without X your program cannot display an image.



if you want it to run in the context of the login manager add it to the login manager's desktop environment. (this was /var/lib/something last time I looked at ubuntu)



else you can replace the login manager with a non-interactive one like 'nodm', which will open toyr session automatically and then just add your c++ app to your session's startup applications.



I'm not sure where you add applications to autostart in openbox, but ~/.xsession always works.



create a ~/.xsession file that does yourapp& and then openbox-session (see the man page for xinit)






share|improve this answer














GTK requires X, without X your program cannot display an image.



if you want it to run in the context of the login manager add it to the login manager's desktop environment. (this was /var/lib/something last time I looked at ubuntu)



else you can replace the login manager with a non-interactive one like 'nodm', which will open toyr session automatically and then just add your c++ app to your session's startup applications.



I'm not sure where you add applications to autostart in openbox, but ~/.xsession always works.



create a ~/.xsession file that does yourapp& and then openbox-session (see the man page for xinit)







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 10 '17 at 5:36

























answered Nov 6 '17 at 9:09









Jasen

1,945713




1,945713











  • Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
    – user145959
    Nov 6 '17 at 18:37
















  • Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
    – user145959
    Nov 6 '17 at 18:37















Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
– user145959
Nov 6 '17 at 18:37




Thanks Jason. As I said in my question, I can run my program manually, as I installed xorg, xserver-xorg-video-fbdev and openbox on my OS. I edited my post, maybe it can clear it more!
– user145959
Nov 6 '17 at 18:37


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?