LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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-03-2003, 10:44 AM   #16
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69

Quote:
Originally posted by JCScoobyRS
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
Sorry d00d, it was just an idea You can also alias your path to apachectl and just call it apache. However, I see you want to use the /etc/init.d/httpd thing, so I will lay off the "other" suggestions

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

Original Poster
Rep: Reputation: 15
I'm trying this:

Code:
#!/bin/sh
      #
      # Startup script for the Apache Web Server
      #
      # chkconfig: 345 85 15
      # description: Apache is a World Wide Web server.  It is used to serve \
      #	       HTML files and CGI.
      # processname: httpd
      # pidfile: /var/run/httpd.pid
      # config: /etc/httpd/conf/httpd.conf


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

      # See how we were called.
      case "$1" in
      start)
      echo -n "Starting httpd: "
      daemon httpd -DSSL
      echo
      touch /var/lock/subsys/httpd
      ;;
      stop)
      echo -n "Shutting down http: "
      killproc httpd
      echo
      rm -f /var/lock/subsys/httpd
      rm -f /var/run/httpd.pid
      ;;
      status)
      status httpd
      ;;
      restart)
      $0 stop
      $0 start
      ;;
      reload)
      echo -n "Reloading httpd: "
      killproc httpd -HUP
      echo
      ;;
      *)
      echo "Usage: $0 {start|stop|restart|reload|status}"
      exit 1
      esac

      exit 0
I get an error: "Starting httpd: execvp: No such file or directory"

Working on it, brb. J
 
Old 03-03-2003, 10:48 AM   #18
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Can anyone see why this is giving me this error? Thanks, Jeremy
 
Old 03-03-2003, 10:53 AM   #19
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
What is execvp? It is not mentioned in the script so why is httpd calling for it?
 
Old 03-03-2003, 10:54 AM   #20
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Can you do an "ls -l /var/lock/subsys/httpd" for me? I think that it's not finding that file due to permissions. Thanks, Jeremy
 
Old 03-03-2003, 10:55 AM   #21
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
Originally posted by Crashed_Again
What is execvp? It is not mentioned in the script so why is httpd calling for it?
Can you post up your script so we can compare?
 
Old 03-03-2003, 10:56 AM   #22
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
-rw-r--r-- 1 root root 0 Mar 2 16:42 /var/lock/subsys/httpd
 
Old 03-03-2003, 10:56 AM   #23
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Code:
#!/bin/sh
      #
      # Startup script for the Apache Web Server
      #
      # chkconfig: 345 85 15
      # description: Apache is a World Wide Web server.  It is used to serve \
      #	       HTML files and CGI.
      # processname: httpd
      # pidfile: /var/run/httpd.pid
      # config: /usr/local/apache2/conf/httpd.conf


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

      # See how we were called.
      case "$1" in
      start)
      echo -n "Starting httpd: "
      daemon httpd -DSSL
      echo
      touch /var/lock/subsys/httpd
      ;;
      stop)
      echo -n "Shutting down http: "
      killproc httpd
      echo
      rm -f /var/lock/subsys/httpd
      rm -f /var/run/httpd.pid
      ;;
      status)
      status httpd
      ;;
      restart)
      $0 stop
      $0 start
      ;;
      reload)
      echo -n "Reloading httpd: "
      killproc httpd -HUP
      echo
      ;;
      *)
      echo "Usage: $0 {start|stop|restart|reload|status}"
      exit 1
      esac

      exit 0
 
Old 03-03-2003, 10:58 AM   #24
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
That's exactly what my permissions are. Can someone post their /etc/init.d/httpd file? If I could compare the two files, we could probably fix this. Thanks, Jeremy
 
Old 03-03-2003, 11:02 AM   #25
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Here it is:

#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/httpd.conf

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

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=/usr/sbin/httpd
prog=httpd
RETVAL=0

# check for 1.3 configuration
check13 () {
CONFFILE=/etc/httpd/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read /usr/share/doc/httpd-2.0.40/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
check13 || exit 1
killproc $httpd -HUP
RETVAL=$?
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL
 
Old 03-03-2003, 11:05 AM   #26
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Is this from the Red Hat installation or is it a fresh, Apache install?
Thanks, Jeremy
 
Old 03-03-2003, 11:10 AM   #27
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
GOT IT!!!

I got it to work with slight modifications. Here is the current, working script for Apache 2.0.44. Thanks alot you all, Jeremy

Code:
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf

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

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
prog=httpd
RETVAL=0

# check for 1.3 configuration
check13 () {
CONFFILE=/usr/local/apache2/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read /usr/local/apache2/doc/httpd-2.0.40/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
check13 || exit 1
killproc $httpd -HUP
RETVAL=$?
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL
 
Old 03-03-2003, 11:12 AM   #28
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Boy that was easy wasn't it
 
Old 03-03-2003, 11:15 AM   #29
JCScoobyRS
Member
 
Registered: Dec 2002
Location: It's a Secret
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: 15
Yes it was. I was trying to get you all to do that earlier but NNOOOOOO. Can't listen to me, I'm just a Linux I see how it it. Just messing with you. Thank you all so much. I really mean that. Take care, Jeremy
 
Old 03-03-2003, 11:18 AM   #30
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Yeah you have to have over 27 Posts in order for somebody to give you what you want. We were just making you sweat a little bit.
 
  


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 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 01:47 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
Open Source Consulting | Domain Registration