LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-17-2004, 02:52 PM   #1
iskrem
LQ Newbie
 
Registered: Nov 2004
Location: Norway
Distribution: Gentoo
Posts: 25

Rep: Reputation: 15
Starting programs on bootup, solutions


Hi, I am new to this forum, and start by asking this:

I have a situation, where I want to start a program on bootup. I have the following solutions to this, and I would like a view on what's the best/most elegant way to do it.

Let's say I want to start a vnc server on bootup. I have the following solutions:
1) Start it by rc.local
2) Putting a script in init.d and make symlinks in appropriate runlevel(s).
3) Start it by using /etc/inittab like this:
vn:4:respawn:/sbin/su <user> -c <command>

Neverthless I am unable to make the last one work.

I would like some feedback on what solution(s) you would choose and why. I would also be happy to know why the last one doesn't work. If it matters, I am runnning Fedora Core 3.
 
Old 11-17-2004, 04:17 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
1. This is quite a clean and straightforward way to do it. Fastest to setup.
Dowsides: hard to stop or restart the process. Recommended way for small custom things that should be run on the startup, but doesn't leave a process running.

2. The recommended way. (Atleast, I would recommend that
Especially suitable for daemons. This way you can control the starting order, runlevels when daemon is being run and the kill/stop order of the process. There is also easy and consistent way to start and stop daemons by hand when needed and you can easily extend the startup script to do other things too (rehash, awaken,dumplog, etc. whatever applies to your daemon).

3. Good for hardwired system processes (eg. the program listening for keyboard input in your virtual terminal) you newer want to stop. I would leave this file alone.

About the problem:
The sentence "Neverthless I am unable to make the last one work." is semantically almost void. Anyways, what you probably mean to say, that the program doesn't start even if you put that line there.

-Did you remember to run "telinit q" after you modified /etc/inittab?
-If so, did you check the messages in dmesg and/or inittab that could explain why it doesnt work?


4. Few more places to drop bootup processes.
a) @reboot -line in /etc/crontab or /etc/cron.d/yourScript or
b) your ~/.crontab
The reasons to use @reboot in /etc/crontab are (IMHO) somewhat strange, but
crontabs for individual users (or even system users) makes sense in many cases (even the @reboot -entry).
See "man crontab" and "man 5 crontab" for details.


btw. what is the command you are trying to run at bootup?
 
Old 11-17-2004, 06:05 PM   #3
iskrem
LQ Newbie
 
Registered: Nov 2004
Location: Norway
Distribution: Gentoo
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks a lot for a quick and good answer. It gave me an indication, not only what would be the best solution to this particular problem, but also a description of the uses of each "solution". I find the crontabs particullary interesting. I am well aware of cron(tab) existence, but I have never thought of using it like this. I need to study cron(tab) further

About the problem:
No, I have not tried to run "telinit -q", because I simply haven't read the manual well enough. I will try what you described, but follow your advice to leave this file alone for this particular matter.

I am trying to start vncserver at bootup for a particular user. Currently I am starting it in init.local, but I will use solution 2 (init.d).

Again, thanks a lot.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
starting programs on bootup mantonr Linux - Newbie 2 05-30-2005 09:07 AM
Starting services at bootup Lucasite Linux - Newbie 5 04-17-2004 02:08 PM
starting apache at bootup softgun Debian 11 08-05-2003 07:17 AM
starting programs at bootup tcm_va Linux - Newbie 5 02-08-2003 08:30 PM
help starting xscreensaver at bootup rose_bud4201 Linux - Software 2 01-10-2003 06:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration