LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-04-2004, 12:27 PM   #1
chunlee
Member
 
Registered: Jun 2004
Location: london
Distribution: gentoo
Posts: 114

Rep: Reputation: 15
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
 
Old 09-04-2004, 12:32 PM   #2
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 46
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
 
Old 09-04-2004, 12:58 PM   #3
chunlee
Member
 
Registered: Jun 2004
Location: london
Distribution: gentoo
Posts: 114

Original Poster
Rep: Reputation: 15
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
 
Old 09-04-2004, 12:58 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.

Last edited by jschiwal; 09-04-2004 at 01:02 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I automatically start a program at start up? victordh Linux - General 7 10-27-2013 06:02 AM
Xhost - How to start it automatically? shazam75 Linux - Software 3 10-17-2004 08:29 AM
Making X start automatically rwescoat Slackware 3 10-06-2004 06:37 PM
How to get Guarddog to start automatically? tigerflag Linux - Security 18 09-17-2003 10:23 AM
X won't start automatically urinal cake Linux - Newbie 5 03-08-2002 05:54 PM


All times are GMT -5. The time now is 09:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration