What distribution? (Debian, Fedora)
I also compiled my apache server. This is what I did:
Do these commands as root
1. cd /etc/init.d
2. ln -s /etc/httpd/bin/apachectl httpd
3. Put this line in you're /etc/rc.local to start service at boot,
/etc/init.d/httpd start
To stop, start and restart manually, # /etc/init.d/httpd [start stop restart]
If you want to start the service without putting full path /etc/init.d/httpd, create a file called httpd in /usr/local/bin. chmod 755 httpd. Put this code in the file:
Code:
#!/bin/bash
httpd()
{
if [ "$1" = "restart" ]; then
/etc/init.d/httpd restart
fi
if [ "$1" = "stop" ]; then
/etc/init.d/httpd stop
fi
if [ "$1" = "start" ]; then
/etc/init.d/httpd start
fi
if [ "$1" = "" ]; then
echo Usage: httpd [ start stop restart ]
fi
}
httpd $1
exit 0
Now you can run httpd "start stop restart". You need to be root to run the script.