Here's a bash script that I uses to start/stop Apache. I put this in /home/QtPalmtop/bin and then attached it to an icon on one of my tabs. It uses the
sudo utility to run stuff as root without having to login as root. You'd need to install that to run the script as is.
I'm also using
Opie-sh to display dialog boxes from the script. Another package you'd want to install.
CODE
#!/bin/bash
#--------------------------------
# Toggle Apache on/off.
# 2003-06-07 - r.l. stoner
#--------------------------------
(
checkit=`ps -ef | grep http | grep -v grep | wc -l`
#echo $checkit
if [ $checkit -ne 0 ]
then
echo "Stopping Apache ..."
sudo killall httpd
opie-sh -m -w -t "Apache Toggled" -M "Apache has been terminated." -g
exit 0
else
echo "Starting Apache ..."
sudo /home/www/bin/httpd
opie-sh -m -I -t "Apache Toggled" -M "Apache has been started." -g
exit 0
fi
) > /tmp/doapach.log
#--- end of script ---#