Building Lynx just for use starting, stoppping, restarting, graceful, status, statusfull, etc. on Apache is silly. Most servers already have Curl or Wget. I prefer wget because it's simple and easy to use.
To use wget instead of lynx, modify your apachectl file as follows:
1. add a line near the top with:
# PIDFILE
PIDFILE='/home/username/local/apache/logs/httpd.pid'
2. About line 90-ish, you'll see status) - you should make it look like this:
configtest)
$HTTPD -t
ERROR=$?
;;
status)
# $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
/usr/bin/wget $STATUSURL -q -O - | egrep '(Current|Restart|uptime)' | sed 's/<[/]*dt>//g'
if [[ -f $PIDFILE ]] ; then
echo "PID: " `cat $PIDFILE`
else
echo "No PID file."
fi
;;
fullstatus)
$LYNX $STATUSURL
;;
*)
This uses wget to grab the status (uptime, restart time, etc.) instead of Lynx, which as I said should be discontinued as a dependency. As you can see, Wget solves the problem easily.
Note that the bottom section for fullstatus) is not changed; I didn't need the fullstatus, if you do, feel free to improve on this text.
Enjoy!
No comments:
Post a Comment