LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   starting a program automatically at boot up (https://www.linuxquestions.org/questions/linux-newbie-8/starting-a-program-automatically-at-boot-up-615659/)

babu198649 01-23-2008 01:17 AM

starting a program automatically at boot up
 
hi
i need to start some of the programs automatically at boot up.
what should i add in the .bashrc file to do this.

indeliblestamp 01-23-2008 05:22 AM

Lets say you want to start the application 'klipper'.
If you add it to your .bashrc, klipper will be started each time you open a terminal. This is clearly not what you want.
Next, you could use the files .xprofile and .xsession. Just add 'klipper' in one of those files, and you will find klipper starting up each time your X session starts up. This is a decent way to start your program at login.
Lastly, if you want to start a program at bootup instead of login (maybe its a server and not a desktop application), you might want to add it in your /etc/rc.d/rc.local file.

[edit: I'm not near my machine right now, am I mixing up .xprofile with .xinitrc?]

babu198649 01-23-2008 06:34 AM

thank u arun
i wnt to start up different programs for different users when they login .
i dont want to change the /etc (as it will set globally ,right,i am not sure)

as u said entering the programs in .bashrc starts every time i start a new shell.
so i have entered in the .bash_profile and it works fine ,except for one thing

i cannot able to start the shell(/bin/bash) i am using GNOME-2.8.0

[babu@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT 2005 i686 i686 i386 GNU/Linux

distributor is redhat

one more problem is ,before the Desktop(GNOME) gets ready my applications which i have entered in the .bash_profile file gets executed.

is there any way to start a shell at startup which should be the child of GNOME.

indeliblestamp 01-23-2008 07:22 AM

If I understand your problem correctly, you want to start your terminal emulator (such as gnome-terminal, xterm, rxvt, konsole, etc). Bash will run inside the terminal.
So try with any one of those 4, they're the most common. A terminal should pop up as soon as you login into Gnome then.
Please correct me if I misunderstood.

Also, to load your applications after Gnome is fully loaded, try using the .xsession file.

babu198649 01-23-2008 07:39 AM

Quote:

A terminal should pop up as soon as you login into Gnome then.
thanks for understanding me :)

Quote:

Also, to load your applications after Gnome is fully loaded,
exactly what i wanted

Quote:

try using the .xsession file.
i have not found any in my home directory.

also i dont wnt the same applications to be started for all the users .different users have different applications to run at startup.

indeliblestamp 01-23-2008 09:41 AM

Oh, glad that bit worked.
I did some googling and discovered that .xsession is primarily used to kick start lightweight window managers (and some applications before the wm itself starts). Apologies, that may not be the appropriate solution for you.
In your case, since you use Gnome, this link has exactly what you need. If you login as each user and follow the steps, you can configure a different set of apps to start for each of them.

geek745 01-23-2008 11:50 PM

yeah, use that, and if you need to run as a user, start in command-line mode, login as root, the su to the user account and start gnome from there. that is if you don't have the users around to let you into their account.

babu198649 01-24-2008 12:03 AM

thank u for the link
it worked almost the same way as entering the paths in the .bash_profile .ie. both methods starts the applications before the Desktop is fully loaded.

the difference between using .bash_profile and gnome session manager is that the later does not show the splash screen.

how can i find the location of the file in which the gnome session manager records the start applications.

indeliblestamp 01-24-2008 12:59 AM

Sorry, I don't use Gnome so I can't help you with the location. Your best bet is probably digging around in ~/.gnome.
About the apps loading before Gnome fully does, I can suggest a temporary workaround: Say you want to start firefox. Create a shell script in ~/bin or /usr/local/bin (or anywhere in $PATH) called firefox-delayed, and put a sleep for a few seconds in it before running firefox. Give it +x permissions and use it in Gnome's application starter instead of the usual firefox binary.
Of course if someone else here has a better suggestion that would be much better.


All times are GMT -5. The time now is 12:55 AM.