I want my c++ program to run automatically when the operating system loaded , i mean when the system starts working .. I am using linux(ubutu) I have no idea to do that ? any idea may help .. thanks in advance
Asked
Active
Viewed 4,476 times
2 Answers
4
(The fact that your program is written in C++ is irrelevant to this answer.)
Simply add a symbolic link to your executable in /etc/init.d/
.
E.g. if your program is in /home/username/soft/myprog
, run:
ln -s /home/username/soft/myprog /etc/init.d/
Make sure the file is executable.

Philippe
- 9,582
- 4
- 39
- 59
-
-
2
-
1Haha! I'll make an exception to the SO "no social networking" rules on this one and say hello! Very useful, thanks! ^^ – Raoul Apr 02 '14 at 00:59
2
An alternate way that might be helpful
Open your .bashrc
file (That can be found in the home directory i.e ~/.bashrc
)
Add to it the line :
./program_executable_path
Also note that the program must have execute permission.
You can grant the permission by using chmod
:
$chmod u+x program_executable_path

axiom
- 8,765
- 3
- 36
- 38
-
2
-
1
-
1Yes it was . Done the corrections. Please correct me if i am wrong, but bashrc is also executed when you log in. – axiom Nov 15 '12 at 14:51
-