#!/bin/sh
#server
#################################
#modify by ajian
#function: It is convenient to restart some servers and reduce the wasted time.
#DATE: 2007-7-2
#################################
#路径配置区
APACHEPATH=""
SMB_LOCAL_PATH1=""
SMB_REMOTE_PATH1=""
SMB_LOCAL_PATH2=""
SMB_REMOTE_PATH2=""
#################################
#应用配置区
SMBUSER=""
SMBPASS=""
SMB_UID=
SMB_GID=
#################################
case $1 in
"apache")
if [ $2 = "start" ]
then
echo "starting apache ..."
$APACHEPATH/apachectl start
echo "apache is started."
pidof httpd
elif [ $2 = "stop" ]
then
echo "stopping apache ..."
$APACHEPATH/apachectl stop
echo "apache is stopped."
elif [ $2 = "restart" ]
then
echo "restarting apache ..."
$APACHEPATH/apachectl stop
sleep 5
$APACHEPATH/apachectl start
echo "apache is restarted."
pidof httpd
else
echo "apache's $2 is error."
fi
;;
"smb")
if [ $2 = "remount" ]
then
echo "remounting smbfs..."
umount -f $SMB_LOCAL_PATH1
umount -f $SMB_LOCAL_PATH2
echo "umount is finished."
sleep 5
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,ui
d=$SMB_UID,gid=$SMB_GID $SMB_REMOTE_PATH1 $SMB_LOCAL_PATH1
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,ui
d=$SMB_UID,gid=$SMB_GID $SMB_REMOTE_PATH2 $SMB_LOCAL_PATH2
echo "mount is finished."
df -h
elif [ $2 = "mount" ]
then
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,ui
d=$SMB_UID,gid=$SMB_GID $SMB_REMOTE_PATH1 $SMB_LOCAL_PATH1
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,ui
d=$SMB_UID,gid=$SMB_GID $SMB_REMOTE_PATH2 $SMB_LOCAL_PATH2
echo "mount is finished."
df -h
else
echo "smb's $2 is error."
fi
;;
"all")
echo "restart apache and remount..."
$APACHEPATH/apachectl stop
sleep 5
umount -f $SMB_LOCAL_PATH1
umount -f $SMB_LOCAL_PATH2
sleep 5
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,uid=$SMB_U
ID,gid=$SMB_GID $SMB_REMOTE_PATH1 $SMB_LOCAL_PATH1
mount -t smbfs -o username=$SMBUSER,password=$SMBPASS,uid=$SMB_U
ID,gid=$SMB_GID $SMB_REMOTE_PATH2 $SMB_LOCAL_PATH2
echo "mount is finished."
df -h
$APACHEPATH/apachectl start
echo "apache is restarted."
sleep 5
pidof httpd
;;
"status")
if [ $2 = "grather" ]
then
echo "Gather the status of the computer ....."
/movivi/status.sh
echo "Gather is finished."
elif [ $2 = "analyze" ]
then
echo "analyze the status.ch ......"
/movivi/analyze.sh
cat /movivi/data/sumary.txt
fi
;;
*)
echo "The method of using the script."
echo ""
echo " server apache stop means: 关闭apache."
echo " server apache start means: 启动apache."
echo " server apache restart means: 重启apache."
echo " server remount means: 关闭Mount点再挂载."
echo " server mount means: 直接挂载Mount点."
echo " server all means: Include all of above."
echo " server status gather means: 收集系统信息."
echo " server status analyze means: 分析处理并显示系统信息."
echo " "
echo ""
;;
esac