chkconfig - Cannot create a service error

Solution Verified - Updated -

Issue

  • getting error on adding new service: "service apache2 does not support chkconfig"

Script looks like:

#!/bin/bash
#
# chkconfig: 345 95 50
# Comments to support chkconfig on RedHat Linux \
# Start/stop/restart the Apache web server.

conf=/etc/apache2/httpd.conf

case "$1" in
   'start')
      /usr/local/apache2/bin/apachectl -k start -f $conf ;;
   'stop')
      /usr/local/apache2/bin/apachectl -k stop -f $conf ;;
   'restart')
      /usr/local/apache2/bin/apachectl -k restart -f $conf ;;
   'graceful')
      /usr/local/apache2/bin/apachectl -k graceful -f $conf ;;
   'configtest')
      /usr/local/apache2/bin/apachectl -t -f $conf ;;
   *)
      echo "usage $0 configtest|graceful|start|stop|restart" ;;
esac

Perms are:

# ls -l /etc/init.d/apache2
-rwxr-xr-x 1 root root 619 May 27 10:00 /etc/init.d/apache2
# chkconfig --add apache2
service apache2 does not support chkconfig

Environment

  • Red Hat Enterprise linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.