#!/bin/sh
#This is a main menu scripts
#*********************************
#define the menu functions
#*********************************
menu () {
cat <<EOF
***********************************
1) QQ | 2) netscape | 3) webserver
***********************************
4) EXIT
EOF
#**********************************
#This is a main programm
#**********************************
while true
do
echo -n "Please choice [1-4]:"
read choice
case $choice in
1) clear
QQ_menu #caling the QQ_menu functions
;;
2) clear
netscape #calling the netscape functions
;;
3) clear
httpd_menu #calling the httpd_menu functions
;;
*) exit
;;
esac
done
}
#This is a main menu scripts
#*********************************
#define the menu functions
#*********************************
menu () {
cat <<EOF
***********************************
1) QQ | 2) netscape | 3) webserver
***********************************
4) EXIT
EOF
#**********************************
#This is a main programm
#**********************************
while true
do
echo -n "Please choice [1-4]:"
read choice
case $choice in
1) clear
QQ_menu #caling the QQ_menu functions
;;
2) clear
netscape #calling the netscape functions
;;
3) clear
httpd_menu #calling the httpd_menu functions
;;
*) exit
;;
esac
done
}
#define the QQ functions
QQ_menu () {
curdate=`date "+%Y-%m-%d %T"`
cat <<EOF
DATE: $curdate
************************
1) start_qq | 2) kill_qq
************************
3) EXIT
EOF
curr_pid=$$
while true
do
echo -n "Please choice [1-3]:"
read choice
case $choice in
1) clear
/software/LumaQQ/lumaqq &
QQ_menu
;;
2) clear
ps -ef|grep lumaqq|grep -v grep|awk '{print $2}'>/tmp/${curr_pid}.txt
for pid in `cat /tmp/${curr_pid}.txt`
do
kill $pid
echo "Tt's Killed!"
rm -f /tmp/${curr_pid}.txt
done
QQ_menu #calling the QQ_menu functions
;;
3) clear
menu #calling the menu functions
;;
esac
done
}
#################
#define the netscape functions
netscape () {
cat <<EOF
**********************************
1) start netscape 2) stop netscape
**********************************
3) EXIT
EOF
current_pid=$$
while true
do
echo -n "Please choice [1-3]:"
read choice
case $choice in
1) clear
echo "Start the netscape......."
/software/navigator/navigator &
netscape
;;
2) clear
echo "Kill netscape......"
ps -ef|grep navigator|grep -v grep|awk '{print $2}'|while read pid
do
kill $pid
done
ps -ef|grep netscape|grep -v grep|awk '{print $2}'|if [ $pid -eq ""]
then
echo "The netscape process was killed!"
fi
netscape
;;
3) clear
menu
;;
esac
done
}
QQ_menu () {
curdate=`date "+%Y-%m-%d %T"`
cat <<EOF
DATE: $curdate
************************
1) start_qq | 2) kill_qq
************************
3) EXIT
EOF
curr_pid=$$
while true
do
echo -n "Please choice [1-3]:"
read choice
case $choice in
1) clear
/software/LumaQQ/lumaqq &
QQ_menu
;;
2) clear
ps -ef|grep lumaqq|grep -v grep|awk '{print $2}'>/tmp/${curr_pid}.txt
for pid in `cat /tmp/${curr_pid}.txt`
do
kill $pid
echo "Tt's Killed!"
rm -f /tmp/${curr_pid}.txt
done
QQ_menu #calling the QQ_menu functions
;;
3) clear
menu #calling the menu functions
;;
esac
done
}
#################
#define the netscape functions
netscape () {
cat <<EOF
**********************************
1) start netscape 2) stop netscape
**********************************
3) EXIT
EOF
current_pid=$$
while true
do
echo -n "Please choice [1-3]:"
read choice
case $choice in
1) clear
echo "Start the netscape......."
/software/navigator/navigator &
netscape
;;
2) clear
echo "Kill netscape......"
ps -ef|grep navigator|grep -v grep|awk '{print $2}'|while read pid
do
kill $pid
done
ps -ef|grep netscape|grep -v grep|awk '{print $2}'|if [ $pid -eq ""]
then
echo "The netscape process was killed!"
fi
netscape
;;
3) clear
menu
;;
esac
done
}
#***************************************
#This scripts control the httpd service
#define httpd_menu functions
httpd_menu () {
curdate=`date "+%Y-%m-%d %T"`
cat <<EOF
DATE: $curdate
*********************************************
1) start httpd 2) show_process 3) stop httpd
*********************************************
4) EXIT
EOF
#define httpd_menu functions finish!
#This scripts control the httpd service
#define httpd_menu functions
httpd_menu () {
curdate=`date "+%Y-%m-%d %T"`
cat <<EOF
DATE: $curdate
*********************************************
1) start httpd 2) show_process 3) stop httpd
*********************************************
4) EXIT
EOF
#define httpd_menu functions finish!
#define the start_httpd functions
start_httpd () {
echo "Start the web server,please waiting..."
/usr/sbin/httpd &
}
#The start_httpd functions defined finish
start_httpd () {
echo "Start the web server,please waiting..."
/usr/sbin/httpd &
}
#The start_httpd functions defined finish
#define show_procee functions
show_process () {
echo "Show the httpd process_id.."
ps -ef|grep httpd|grep -v grep|awk '{print $1,$2,$8}'
sleep 10
show_process () {
echo "Show the httpd process_id.."
ps -ef|grep httpd|grep -v grep|awk '{print $1,$2,$8}'
sleep 10
}
#define over
#define over
#define the kill_httpd functions
kill_httpd () {
echo "Stop the web server,please waiting...."
ps -ef|grep httpd|grep -v grep|awk '{print $2}'|while read pid
do
echo "$pid"
kill $pid
done
echo "The web server was stopped!"
}
#define the kill_httpd functions finish!
#main scripts
while true
do
echo -n "Please choice [1-4]:"
read choice
case $choice in
1) clear
start_httpd
echo "It's started....."
httpd_menu
;;
2) clear
show_process
httpd_menu
;;
3) clear
kill_httpd
httpd_menu
;;
4) clear
menu
;;
esac
done
}
#This is main programm
menu #Calling the menu functions
kill_httpd () {
echo "Stop the web server,please waiting...."
ps -ef|grep httpd|grep -v grep|awk '{print $2}'|while read pid
do
echo "$pid"
kill $pid
done
echo "The web server was stopped!"
}
#define the kill_httpd functions finish!
#main scripts
while true
do
echo -n "Please choice [1-4]:"
read choice
case $choice in
1) clear
start_httpd
echo "It's started....."
httpd_menu
;;
2) clear
show_process
httpd_menu
;;
3) clear
kill_httpd
httpd_menu
;;
4) clear
menu
;;
esac
done
}
#This is main programm
menu #Calling the menu functions