LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 02-20-2008, 04:00 PM   #1
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Rep: Reputation: 16
Question Registering service


Hello friends;

I just installed apache 2. I installed it normally, not with rpm and yum.

So that there's no service httpd (or apache) start stop command.

I've copied apachectl as httpd to "/etc/rc.d/init.d/"

Now service httpd start stop restart is working.

But still my centos 4 can't see it as service. For example it doestn't start httpd after reboots automaticly.

I've remember that there's a command that register that httpd (apachectl) file as service. But i can't remember :/
 
Old 02-20-2008, 04:12 PM   #2
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
You have to do the following,
Code:
#chkconfig --add httpd
#chkconfig httpd on
 
Old 02-20-2008, 04:25 PM   #3
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
Yes, that is the commandi i remember again. Thanks.

But it says "service httpd does not support chkconfig"

What can i do now? Do you have an idea?
 
Old 02-20-2008, 04:41 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
you would need to customize the script to add chkconfig metadata at the top. it's just a line or two that says something like "# chkconfig 12 88" to say when to stop and start it. that's *not* the line btw... i can't remember what it looks like but check some others in your system for examples. or just directly symlink the script and ignore chkconfig completely, you don't need it.
 
Old 02-20-2008, 06:27 PM   #5
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
@acid_kewpie
I can't find the difference :/
But i copied the apachectl service script and the yum service script. Yum service script shows at services normally.

And also i don't know about symlink. Can you give me some article link about that?

My httpd service script

Code:
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart
#       6 - httpd could not be restarted during a restart
#       7 - httpd could not be restarted during a graceful restart
#       8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache2/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache2/bin/envvars; then
  . /usr/local/apache2/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    $HTTPD -k start -DSSL
    ERROR=$?
    ;;
configtest)
    $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR

My yum service script

Code:
#!/bin/bash
#
# yum           This shell script enables the automatic use of YUM
#
# Author:       Seth Vidal <skvidal@phy.duke.edu>
#
# chkconfig:    - 50 01
#
# description:  Enable daily run of yum, a program updater.
# processname:  yum
# config: /etc/yum.conf
#

# source function library
. /etc/rc.d/init.d/functions

lockfile=/var/lock/subsys/yum

RETVAL=0

start() {
        echo -n $"Enabling nightly yum update: "
        touch "$lockfile" && success || failure
        RETVAL=$?
        echo
}

stop() {
        echo -n $"Disabling nightly yum update: "
        rm -f "$lockfile" && success || failure
        RETVAL=$?
        echo
}

restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|force-reload)
        restart
        ;;
  reload)
        ;;
  condrestart)
        [ -f "$lockfile" ] && restart
        ;;
  status)
        if [ -f $lockfile ]; then
                echo $"Nightly yum update is enabled."
                RETVAL=0
        else
                echo $"Nightly yum update is disabled."
                RETVAL=3
        fi
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
        exit 1
esac

exit $RETVAL
 
Old 02-21-2008, 04:18 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
# chkconfig 12 88

is pretty darn close to

# chkconfig: - 50 01

don't you think? did you actually read what i said about that?
 
  


Reply

Tags
apache, chkconfig, httpd, service


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
registering with redhat chlawren Linux - Newbie 1 11-13-2005 09:35 AM
Error registering service with slp -20 manya05 Linux - Networking 1 09-20-2005 06:00 PM
Error registering service with slp -20 manya05 Linux - Enterprise 1 09-20-2005 05:59 PM
registering winlinux2003 kazam Linux - Newbie 1 07-04-2004 06:25 AM
Registering nameservers Polaris2203 Linux - Networking 7 09-15-2003 09:13 PM


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