Where should I put my C++ program to run at startup? [closed]
Clash 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?
boot startup c++
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.
add a comment |Â
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?
boot startup c++
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
add a comment |Â
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?
boot startup c++
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?
boot startup c++
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
add a comment |Â
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
add a comment |Â
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
)
Thanks Jason. As I said in my question, I can run my program manually, as I installedxorg, 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
add a comment |Â
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
)
Thanks Jason. As I said in my question, I can run my program manually, as I installedxorg, 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
add a comment |Â
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
)
Thanks Jason. As I said in my question, I can run my program manually, as I installedxorg, 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
add a comment |Â
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
)
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
)
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 installedxorg, 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
add a comment |Â
Thanks Jason. As I said in my question, I can run my program manually, as I installedxorg, 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
add a comment |Â
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