LinuxQuestions.org
Visit Jeremy's Blog.
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 03-02-2003, 11:19 PM   #1
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Rep: Reputation: 15
Creating a Service


I have just installed Apache and MySQL on a fresh Red Hat installation. Since I didn't have Red Hat install them for me, I don't have the ability to use Apache and MySQL as a service. No convenience of "/sbin/service httpd start". This isn't a huge inconvenience but since I want to know as much as possible about Linux and it's capabilities, I would like to create my own Bourne Script like the ones built during the installation of Red Hat. Has anyone here written their own script similar to the one created for Apache by Red Hat? If so, could you help? Thanks, Jeremy
 
Old 03-03-2003, 08:02 AM   #2
acid2000
Member
 
Registered: Nov 2001
Location: Exeter, UK
Distribution: Gentoo 1.4
Posts: 243

Rep: Reputation: 30
Don't you have
/etc/init.d/apache
so you can use
/etc/init.d/apache start, thats the standard way to start services.
 
Old 03-03-2003, 08:46 AM   #3
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I think Apache uses the service name httpd-perl (?) or something similar.

Try from a terminal:

chkconfig --list

That gives you a list of all services (at least the ones that chkconfig knows about). If it's not in that list, though, I am not too sure... probably like acid2000 says, it'd be under /etc/init.d/something-or-other.
 
Old 03-03-2003, 09:40 AM   #4
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
I don't have an "/etc/init.d/apache" or "/etc/init.d/httpd". What do I do now? I know that I can start Apache like "/usr/local/apache2/bin/apachectl start" but that doesn't make it a service. I want to have the ability to go to the Services Tool and start/stop/restart from there if I wish. I know it's not critical but I would like to know how to do it. Thanks, Jeremy
 
Old 03-03-2003, 09:55 AM   #5
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
I can't understand why you don't have an /etc/init.d/httpd script??? It should be created when you install apache. Anyway if I were to give you my /etc/init.d/httpd script would that help? You would have to go over it and see if all the paths are correct for you.
 
Old 03-03-2003, 10:18 AM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 69
Yeah, it probably would. However, what about putting that path in your /etc/init.d/httpd file (if one doesn't exist, try creating one). Just fire up a text editor, open up /etc/init.d/httpd and type:
/usr/local/apache2/bin/apachectl
Save and exit. Now can you:
/etc/init.d/httpd start
?

I use apachectl personally, mainly because /etc/init.d/httpd isn't universal.

Cool
 
Old 03-03-2003, 10:23 AM   #7
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Hmmm...very interesting MasterC. Will it pass the 'start' argument to the apachectl command? You never cease to amaze me. No wonder you are the Master. I'm no scripter but wouldn't you have to do something like:

#!/bin/bash
#
/usr/local/apache2/bin/apachectl $1
 
Old 03-03-2003, 10:25 AM   #8
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 69
I've got no idea. It was just an idea. I'm definitely no scripter, nor Master of anything besides Medications (I'm a Pharmacy Technician ).

Cool
 
Old 03-03-2003, 10:26 AM   #9
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
If I had your httpd file, I could modify it to suit my needs. If I get that, will it give me the ability to use the Service Tool to start/stop/restart the service from the GUI? Thanks, Jeremy
 
Old 03-03-2003, 10:27 AM   #10
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
I have no clue if it will show up in the GUI or not. Try MasterC's suggestion first. I have become curious now. You are our guinea pig.
 
Old 03-03-2003, 10:33 AM   #11
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 69
he he he...

I don't know if it'd show up in your gui, but it might show up with chkconfig for ya. Via a system of symlinks you might be able to get it appear though, make it believe you installed the one from the distro's CD. The hitch is finding where the distro wants to look for things.

Cool
 
Old 03-03-2003, 10:36 AM   #12
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
try ntsysv
 
Old 03-03-2003, 10:39 AM   #13
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Following your directions, it does not pass the start parameter. I wouldn't mind seeing someone's /etc/init.d/httpd file so that WE can figure this out. I will be a guinea pig as long as I help someone out. Later, J
 
Old 03-03-2003, 10:40 AM   #14
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
hanzerik,
That would work IF apache/httpd was already a service. It's not though. Thanks, Jeremy
 
Old 03-03-2003, 10:42 AM   #15
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Paste the following into your httpd file. Make it executable and then try it again.

#!/bin/bash
#
/usr/local/apache2/bin/apachectl $1
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a service as a system service Dakkar SUSE / openSUSE 2 07-13-2005 07:36 AM
creating own service cranium2004 Programming 1 03-02-2005 09:11 PM
creating own service cranium2004 Linux - Newbie 1 03-02-2005 09:00 PM
/sbin/service is empty every weekend and changed to service.1 LineS Linux - General 0 05-24-2004 02:08 AM
creating a RH9 startup service fritz101 Red Hat 3 12-20-2003 10:30 AM

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

All times are GMT -5. The time now is 03:13 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