Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Usually in Linux systems the scripts in /etc/rc.d or init.d are executed during boot, rc.local usually being the last one. That's the most direct way I can imagine..
Perhaps you mean that the program must run just after a user (or any user) logs in? In this case you could start the program by inserting its path into "~/.profile", or?
In my case I wanted to start up X whenever the user was logging in through the console that appears just after the boot sequence ends, but not when other users (or the same one) was logging in through ssh or other local terminals, so I wrote the following .profile file:
Code:
VIA ~ # cat ~/.profile
echo "This is your .profile script"
TERMINAL=$(tty)
if [ "$TERMINAL" = "/dev/tty1" ]
then
echo "This is the main terminal, so I am starting up X"
/home/shared/scripts/startx_custom
else
echo "This is a secondary terminal, so I won't start up X"
fi
Perhaps you mean that the program must run just after a user (or any user) logs in? In this case you could start the program by inserting its path into "~/.profile", or?
In my case I wanted to start up X whenever the user was logging in through the console that appears just after the boot sequence ends, but not when other users (or the same one) was logging in through ssh or other local terminals, so I wrote the following .profile file:
Code:
VIA ~ # cat ~/.profile
echo "This is your .profile script"
TERMINAL=$(tty)
if [ "$TERMINAL" = "/dev/tty1" ]
then
echo "This is the main terminal, so I am starting up X"
/home/shared/scripts/startx_custom
else
echo "This is a secondary terminal, so I won't start up X"
fi
Hi,
Is this ~/.profile means .bash_profile or it's different file,
if it is differnet my linux don't have that? what to do next?
The name might be different and if it does not exist yet, jut create it. In my case it wasn't existing. And yes, I use Bash as a terminal and normally the bash file is called ".profile", but I don't exclude that in your case it might be called ".bash_profile".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.