LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-11-2005, 10:44 AM   #1
hello321_1999
Member
 
Registered: Nov 2004
Posts: 33

Rep: Reputation: 15
What's the correct method to start inetd?


I am a newbiew running SuSE Linux Enterprise Server 8.2

I want to start a program (inetd) each time my server is booted.

Currently, I have this working by adding the following lines to the /root/.profile file :
# 18 Oct 2005, Start the inetd process
inetd &

So, when i reboot the machine, I log-in as root and inetd is started. However, when others are using the machine and su (switch user) to root, a new inetd is started. After a few weeks, there are lots of inetd processes running.

What/Where is the correct file where I should startup inetd? I assume this file is run only once during boot up and then never again. Or is there a better solution to fix this? Is see the inetd man page says, "inetd should be run at boot time by /etc/init.d/inetd", but I'm not sure what this means. Please add some detail to your answers as I am a newbie!
 
Old 11-11-2005, 11:08 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
inetd or xinetd should be started automatically by the system. You should not run it as a user There should only be one inetd (or xinetd) running.

On my Debian inetd is started by the script /etc/init.d/inetd.

On my Redhat xinetd is started by /etc/init.d/xinetd.

(Actually this is started by links in /etc/rc?.d back to the files in /etc/init.d.)

You do not need BOTH inetd and xinetd. I don't use Suse so don't know which it runs. If it runs inetd then your configuration should be in /etc/inetd.conf. If it runs xinetd then your configuration will be individual files under the directory /etc/xinetd.d (there is also an /etc/xinetd.conf but that file deals with the startup rather than the services like inetd.conf).
 
Old 11-11-2005, 11:32 AM   #3
hello321_1999
Member
 
Registered: Nov 2004
Posts: 33

Original Poster
Rep: Reputation: 15
Okay. I do have the file /etc/init.d/inetd. It is a script.

My rc?.d files exist in /etc/init.d/rc?.d

In which rc?.d should I add my link to /etc/init.d/inetd?

p.s. Just out of curiosity, is there a file that does what I wanted in my first post (i.e. a startup file that is run once during bootup and then never again?)
 
Old 11-11-2005, 11:53 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
Answering your last question first. Yes. That is the purpose of the /etc/init.d scripts.

The ? in rc?.d is the run level that the script gets executed in. 1 = single user, 2 = first multi-user, 3=second multi-user etc... (Type "man init" for info on the different run levels.) Typically networking and X windows are started in run level 3 or 4.

/etc/init.d/rc?.d probably ALREADY has links to the script in init.d. It will have specialized names as for example:

From Debian:
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc0.d/K20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc1.d/K20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc2.d/S20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc3.d/S20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc4.d/S20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc5.d/S20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 15 Feb 11 2005 /etc/rc6.d/K20inetd -> ../init.d/inetd


From RedHat:
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc0.d/K50xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc1.d/K50xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc2.d/K50xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc3.d/S56xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc4.d/S56xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc5.d/S56xinetd -> ../init.d/xinetd
lrwxr-xr-x 1 root root 16 Aug 4 14:23 /etc/rc6.d/K50xinetd -> ../init.d/xinetd

The entries with "K" in their name are stop (kill) entries and the ones with "S" in their names are the start entries. If you examin the script you'll see it has a function defined as "start)", one defined as "stop)" and others. The number following the "K" or "S" gives the order in which it stops or starts. (50 would start after 30 but before 70).

If inetd is not being started automatically it suggests your configuration may have something odd in it. After a boot do "ps -ef |grep inetd" and see if its running. If not then try running "/etc/init.d/inetd start" from the command line and see if it gives you any errors that would tell you why it didn't start.

FYI: If you make changes to inetd.conf and need to restart inetd you shouldn't stop it and start it but just do "kill -1 inetd". This sends a sighup to inetd and inetd interprets that a command to reread its configuration file.
 
Old 11-11-2005, 12:00 PM   #5
hello321_1999
Member
 
Registered: Nov 2004
Posts: 33

Original Poster
Rep: Reputation: 15
jlightner - thanks for your help on this. I will test this change on Monday and report back on this post. Is there a command I can run to see which run level I am currently in? (this will save me figuring this out using trial and error!)
 
Old 11-11-2005, 12:07 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
No problem.

"who -r" will show you current run level.
 
Old 11-11-2005, 02:18 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,493
Blog Entries: 4

Rep: Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950Reputation: 2950
You'll notice that all of the files in the rc?.d directories (where "?" is a number corresponding to a runlevel) are symbolic links. In other words, they "point to" the actual script-files which are stored in a common location.

You will also notice that all of those links have a consistent name: "S" or "K", followed by a two-digit number, followed by a descriptive name. "S" stands for start, "K" for kill. The two digits are used to put the file-names in a certain order ... init works through the files in ascending (or descending) order by name.

The file which ultimately drives the process is /etc/inittab, and the man pages on init and inittab are very informative.
 
  


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
cant start the yast inetd config vtecturbo13 SUSE / openSUSE 1 03-08-2005 03:28 AM
Start vsftpd with inetd Thinkgeekness Linux - Software 25 07-02-2004 08:01 AM
What is the correct method to change mount point? davidas Linux - Newbie 4 04-19-2004 03:54 PM
inetd doesnt start vsftpd suse rvn Linux - Newbie 11 10-15-2003 03:36 PM
how do you start and stop inetd / proftpd? wendallsan Linux - Networking 2 10-14-2003 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration