Click to See Complete Forum and Search --> : HOW TO run executable from "/"


npereira
08-17-2001, 07:30 PM
What do i have to do to make a shortcut to a executable that is in /usr/local/apache/bin"

The file is "apachectl start"

bdl
08-17-2001, 07:47 PM
Normally something like this would be in one of your system's init scripts, found under /etc/rc.d or perhaps /etc/init.d depending on which linux distro you are using. Look for a file named 'rc.httpd' or simply 'httpd'. If that file doesnt exist, you can create one like so:

prompt# touch /etc/init.d/httpd
prompt# chmod +x /etc/init.d/httpd
prompt# vi /etc/init.d/httpd

(or use your favorite editor: emacs, pico, ae, ee)

This is what the file might look like:


#!/bin/sh

# example httpd script
# change for your system
# ymmv

httpd=/usr/local/apache/bin/apachectl

if [ -x "$httpd" ]; then

case "$1" in

start)
"$httpd" start
;;

restart)
"$httpd" restart
;;

stop)
"$httpd" stop
;;

*)
echo -e "Usage: [start|restart|stop]\n"
;;
esac

else echo -e "$httpd not found on this system.\n"

fi


# eof




You might call this script from within the already present networking script, or rc.local, whatever suits you. If you are running sys-v init and know a little about how that works, create symlinks to your rc0.d~rc6.d directories.

If you simply want to call the apache daemon manually on startup, just login to the console as root, or 'su' to root if you're logged in as a regular user (this is more preferable, BTW) and issue the command:

prompt# /usr/local/apache/bin/apachectl start


Thats it. Luck!

[ 17 August 2001: Message edited by: bdl ]