LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   start apps automatically on start up? (https://www.linuxquestions.org/questions/linux-newbie-8/start-apps-automatically-on-start-up-226594/)

chunlee 09-04-2004 12:27 PM

start apps automatically on start up?
 
hi there:

just got a quick question. how can i start a application automaticlly when the system boots up? do i need to write a script for it?

many thanks

CHUN

ppuru 09-04-2004 12:32 PM

you can put them in /etc/rc.local to start automatically.

OR

you can write a start/stop script, put it in /etc/init.d and create appropriate S and K links to the script at the appropriate runlevels.

For example if you want your application to start at runlevel 3, you can

ln -sf /etc/init.d/myscript /etc/rc.d/rc3.d/S99myscript

and the Kill scripts in runlevels 0 and 6

ln -sf /etc/init.d/myscript /etc/rc.d/rc0.d/K02myscript

jschiwal 09-04-2004 12:58 PM

You didn't indicate what kind of application you want to run, console application, daemon, KDE, X windows application. You also need to consider when you want it to run, and for who.

If it is a daemon, under which run levels do you want it to run? Here slackware may be different then Red Hat linux. Red Hat, Mandrake, Suse and others place startup scripts in /etc/rc.d and links to them in /etc/rc.<run level>/ with a name following the pattern S<#>name and K<#>name where the number indicates the order (alphabetic) that a service should start. The K script is for killing the script.

If it is a KDE application, there is a KDE startup program where you would place a link to the application. Do you want the application to run whenever you log in?

Or if it is a console application that you want to run whenever you want to log in, then your ~/.bash_login script may be a better choice. Of course you may use a different shell, or you may wish the application to run for everyone logging in regardless of whether the use the Bash shell or the Csh. In that case a shell startup script that both execute for log-in may be better (One of the profile scripts). The .bashrc runs everytime the shell is opened and so is better for bash specific options set each time someone opens the bash shell.

There is a X-windows startup script that will execute regardless of which windows manager you use, that you could use for X apps.

Just to recap, you need to consider the user scope, runlevels, and program type to determine how the program or service should be started.

chunlee 09-04-2004 12:58 PM

hi there:

thanks for your reply. as i have not done any scripting before, i thought i will just try with your first suggestion.

do i put the path to the application in rc.local in a new line? i tried it but nothing happened.i think i need look up some more on rc.local.

cheers

CHUN


All times are GMT -5. The time now is 03:25 AM.