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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-20-2004, 06:32 AM
|
#1
|
|
LQ Newbie
Registered: Aug 2003
Posts: 19
Rep:
|
Correct way to run daemon at startup
Hi,
I'm running thttpd to serve my static content. What's the best/correct way to have it run at startup? Should I add a line to rc.local? I'm running Suse 9.
Thanks,
Rob
|
|
|
|
09-20-2004, 07:17 AM
|
#2
|
|
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990
Rep:
|
Adding it to rc.local is a perfectly valid (and simple) way to start it, but note that this will always be started regardless of the runlevel.
The “better” way is to create a script in /etc/init.d that starts the daemon if called with the command-line option “start”, stops it with “stop”, restarts it with “restart”, or reloads it (signals it to re-read its configuration files, if any) with “reload”. You can then create a symbolic link to this script in each of the various runlevel directories, of this form:
/etc/rcX.d/SYYname
Where:
X is the runlevel (one symlink for each runlevel)
S means start the daemon on entering this runlevel (replace with K to stop the daemon instead)
YY is a number; daemons are started/stopped in the order when sorted by this number
name is the name of the script to start/stop the daemon
The only real advantage of the latter approach is that you can then use the YaST's runlevel editor to start and stop the daemon.
|
|
|
|
09-20-2004, 07:25 AM
|
#3
|
|
LQ Newbie
Registered: Aug 2003
Posts: 19
Original Poster
Rep:
|
Thanks rjlee - very helpful.
Think I'll go for the "better" approach, like the idea of being able to start/stop/restart easily.
Really stupid question - but what's a runlevel?
Thanks,
Rob
|
|
|
|
09-20-2004, 07:40 AM
|
#4
|
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,471
Rep: 
|
It's a configuration, a list of services running. You can have many runlevels in your system (plus special ones for reboot, for example), so different configurations you can switch between. You can see a list in /etc/inittab (comments at the beginning of the file).
|
|
|
|
09-20-2004, 07:49 AM
|
#5
|
|
LQ Newbie
Registered: Aug 2003
Posts: 19
Original Poster
Rep:
|
Ok, so I see there's a startup script for Apache in '/etc/init.d/rc3.d' called 'S02httpd', would 'rc3.d' be right right place to put a startup script for thttpd? What is the difference between the runlevels?
Thanks,
Rob
|
|
|
|
09-20-2004, 07:59 AM
|
#6
|
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,471
Rep: 
|
The script in /etc/init.d/rc3.d is probably just a symlink to one in /etc/rc.d/init.d. Directories like rc3.d are places where runlevel configuration is kept. 3 means it's runlevel 3. If you use that runlevel and wish to run thttpd on it, copy/symlink your starting script. To see your current runlevel run 'runlevel' command.
What's the difference between runlevels? Browse /etc/init.d/rc2.d, rc3.d etc. You should see different sets of scripts. That's the difference. The services started at boot at a certain runlevel. I may add that you can completely reconfigure them to suit your needs.
|
|
|
|
09-20-2004, 08:09 AM
|
#7
|
|
LQ Newbie
Registered: Aug 2003
Posts: 19
Original Poster
Rep:
|
Thanks Mara.
So, would this do as a template for the runtime script? It says it's for Solaris but I assume the syntax is the same:
http://www.tech-recipes.com/solaris_...n_tips148.html
|
|
|
|
09-20-2004, 08:11 AM
|
#8
|
|
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990
Rep:
|
Yes, but replace /usr/iplanet/webserver/https-www.tech-recipes.com/start stop etc. with the actual commands to start/stop your daemon.
|
|
|
|
09-20-2004, 08:19 AM
|
#9
|
|
LQ Newbie
Registered: Aug 2003
Posts: 19
Original Poster
Rep:
|
Now you're just mocking me  No worries, I can take it from here. Thanks again for your help guys.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:23 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|