Linux - NewbieThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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).
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.