LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-06-2009, 05:59 AM   #1
mrlinux2000
Member
 
Registered: Feb 2008
Posts: 144

Rep: Reputation: 15
how to start a service at the start of PC


Hello !

i use FC8 and i want some services like HTTPD and NAMED to start at the start of the system , how to create a script to do that ...
thanks
 
Old 12-06-2009, 06:33 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
chkconfig <service> on

You usually don't - you use a supported release of fedora instead. I understand f12 is current and f11 is still supported. f8 is unsupported now, so you can expect increasing difficulty maintaining it. If a 16 month turnaround is too fast for you, consider RHEL, CentOS or Ubuntu LTS.

I'm guessing you want to run the box as a web and name server? That would be apache and bind?

http://hacktux.com/fedora/apache

Note: I'm just guessing that FC8 means "fedora 8".
 
0 members found this post helpful.
Old 12-06-2009, 07:19 AM   #3
mrlinux2000
Member
 
Registered: Feb 2008
Posts: 144

Original Poster
Rep: Reputation: 15
what i want is so simple, i want a service to be started at the start of the system, what ever bind or apache or squid ...
HTTPD just an example it doesnt start automatically i have every boot to type : service httpd start

i want that to be uatomatically

Last edited by mrlinux2000; 12-06-2009 at 07:21 AM.
 
Old 12-06-2009, 08:22 AM   #4
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Running the command
Code:
chkconfig httpd on
will configure init to start httpd automatically.
 
1 members found this post helpful.
Old 12-06-2009, 08:27 AM   #5
mrlinux2000
Member
 
Registered: Feb 2008
Posts: 144

Original Poster
Rep: Reputation: 15
thanks,
and the script to be start at the start of the system
 
Old 12-06-2009, 09:40 AM   #6
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Quote:
Originally Posted by mrlinux2000 View Post
thanks,
and the script to be start at the start of the system
No, he means that you type
Code:
chkconfig httpd on
once and that from then on, httpd will start automatically.

But that doesn't really answer your question, because you said

Quote:
want a service to be started at the start of the system, what ever bind or apache or squid ...HTTPD just an example
and that's the problem, because there are multiple possibilities for starting things up.

This is actually a very complicated subject. You can start things in /etc/inittab. For the moment I'll ignore distros that don't use inittab or are in transition ( Ubuntu in the Linux world is transitioning to Upstart, BSD and Mac OS never used inittab ).

You can also start things by putting scripts into the directories that existing inittab entries run through. Some of these scripts already exist in an unactivated state and that's what "chkconfig" does on systems that support it - it makes links into appropriate directories to scripts and those scripts will be run at startup because inittab runs a script that looks for those and runs.

So, for example, inittab runs /etc/rc and passes it a runlevel argument. If that's 5, scripts in /etc/rc5.d are run. AS I said, :"chkconfig" just activates these:

Code:
# pwd
/etc/rc5.d
# ls *httpd
K15httpd
# chkconfig httpd on
# ls *httpd
S85httpd
# chkconfig httpd off
# ls *httpd
K15httpd
#
Scripts that begin with K are "kill scripts" - they stop the service. "S" scripts start it. Actually they are the same script (a link to /etc/rc.d/init.d/httpd) , but the /etc/rc script calls "S" scripts with "start" as an argument and "K" scripts get passed "stop". If you look at script, you'll see how it parses the arguments.


You could also just add entries to a script that always runs. On almost all systems, there's a "/etc/rc.local" script. You COULD add "service httpd start" to that or "/etc/rc.d/init.d/httpd start" to /etc/rc.local, but the advantages of letting chkconfig and the rc scripts handle it should be obvious.

Another place for daemons is in /etc/xinted.d but this is long enough already.

I put additional info (like how to add your own script to chkconfig) at http://aplawrence.com/Basics/unix-st...scripts-1.html

Last edited by pcunix; 12-06-2009 at 02:10 PM. Reason: Additional info
 
Old 12-06-2009, 01:17 PM   #7
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
I guess on FC8 there is a command - ntsysv - that you can use to control the service start up for all services at glance.
 
Old 12-06-2009, 09:46 PM   #8
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by mrlinux2000 View Post
what i want is so simple, i want a service to be started at the start of the system, what ever bind or apache or squid ...
HTTPD just an example it doesnt start automatically i have every boot to type : service httpd start

i want that to be automatically
In post #2, the first line answers your question :)

It is pretty unusual for someone to want to know how to generically start a service without an actual application in mind - it is the sort of question that gets asked as an exercise or assessment - in an exam or as homework.

As you have found out, what you have asked is not, in fact, so simple as it appears - there are many possible replies. A context helps us figure out the kind of answer which is likely to help you.

for more information - see the man pages for:

chkconfig
serviceconf
and, yes,
ntsysv

Last edited by Simon Bridge; 12-06-2009 at 09:49 PM.
 
1 members found this post helpful.
Old 12-25-2009, 12:29 PM   #9
mrlinux2000
Member
 
Registered: Feb 2008
Posts: 144

Original Poster
Rep: Reputation: 15
thnx
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Q: how to start a service when system start acerlinux AIX 2 04-10-2009 05:45 AM
why my ntop can't start using service ntop start command cmx08 Linux - Software 5 10-21-2008 10:52 PM
when i try to start samba pdc's smb service nmbd failed to start . sandeepchau123 Linux - Newbie 2 10-20-2007 01:59 PM
service xyz start instead of /etc/init.d/xyz start stefaandk Fedora 3 08-01-2006 08:00 PM
service could not start LinuxRam Linux - Newbie 4 08-26-2004 06:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:00 PM.

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