So I have an executable (output of gcc compiling a C program), that I would like to run after login so it is the first thing a user sees upon login. It is a graphical menu that displays system information (read only).
After experimenting around with /.profile
, by simply adding the following bash command with the path to the executable:
exec /home/TUI/bin/main
I was able to get my program to run and display the UI after login, but then upon exiting, I am continually prompted to login again in a loop and the process repeats over and over. I believe I am not putting the script in the right location. Would it go in /etc/rc.local
? ~/.bashrc
... ?
What would be the best way to go about getting the program to run after a user logs in? (I'm not very experienced with shell scripting and the initialisation process of Ubuntu.)
exec
is used to replace the current shell with a command! Omit theexec
and only run the script.