|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我写的Domino脚本如下
但是在SERVER shutdown时,Domino server却不能正常停止Domino server (启动时已经运行了/etc/rc0.d/k99notes stop)不知道是什么原因!请高手指教一下,小弟在这里先谢了!!(我的系统是:Sun Solaris 8 Japanese.)谢谢谢谢谢谢!
STARTDOMINO.SH
#!/bin/sh
# Description
# start Domino server
# 2004/05 Hitachi Software
######################
if [ ! "$1" ] || [ ! "$2" ]
then
echo "Usage: startdomino.sh NOTES_USER NOTES_SERVER"
exit 1
fi
##### Environment #####
##### Notes #####
NOTES_USER=$1
NOTES_SERVER=$2
NOTES_PATH=/opt/lotus/bin
##### Shell #####
SHELL_PATH=/notesshell
IO_PATH=$SHELL_PATH/$NOTES_SERVER
##### Input/Output #####
#INPUT=$IO_PATH/input.file
##### Time Format(yymmdd@hhmmss) #####
TIME=`date +"%y%m%d@%H%M%S"`
##### Notes data directory
case "$NOTES_USER" in
'fjflm102')
NOTES_BASE=/notes1/fjflm102
;
'fjflm103')
NOTES_BASE=/notes2/fjflm103
;
'fjflm104')
NOTES_BASE=/notes/fjflm104
;
*)
echo "Notes user not exist"
exit 1
;
esac
NOTES_DATA=$NOTES_BASE/data
##### Log directory #####
LOG_PATH=$NOTES_BASE/log
EVENT_LOG=$LOG_PATH/event.log
OUTPUT_LOG=$LOG_PATH/domino.log
##### LOG_PATH Exist?
if [ ! -d $LOG_PATH ]
then
mkdir $LOG_PATH
fi
#outlog copy
test -f $OUTPUT_LOG && cp $OUTPUT_LOG ${LOG_PATH}/old_${TIME}domino.log
#Eventlog copy
#cp $EVENT_LOG ${LOG_PATH}/old_event.log
##### Initialize redirection files
#rm -f $INPUT
#touch $INPUT
rm -f $OUTPUT_LOG
echo "" > $OUTPUT_LOG
##### user check (NOTES_USER?)
if [ `/usr/xpg4/bin/id -u` -ne `/usr/xpg4/bin/id -u ${NOTES_USER}` ]
then
echo "error: can't execute. change Domino User (${NOTES_USER})\n"
exit
fi
##### Domino server Execute?
NOTES_RUNNING=`ps -fu $NOTES_USER | grep /65010/ | grep -v grep`
if [ -n "$NOTES_RUNNING" ] then
echo "error: Domino Server(${NOTES_SERVER}) is Running\n"
exit 1
fi
##### Cleaning Enviroment - ~notes.lck, shared mem, .NOTESMEM* (for ABORT)
rm -f ~notes.lck
mems=`ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F"m" '{ print $2 }'
| awk '{ print $1 }'`
sems=`ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F"s" '{ print $2 }'
| awk '{ print $1 }'`
for j in $mems;do if [ -n "$j" ] then ipcrm -m $j;fi;done
for j in $sems;do if [ -n "$j" ] then ipcrm -s $j;fi;done
for i in ` ls -al /tmp | grep NOTESMEM | awk '/ '$NOTES_USER' / {print $9}'`
do
echo "removing mmap file " $i
rm -f /tmp/$i
done
# enable this if server is password-protected.(<- not USED.)
#cat $IO_PATH/domino_pass_$NOTES_SERVER > $INPUT
# logging event
echo "$TIME Starting Domino Server" >> $EVENT_LOG
# start Domino server
#cd $NOTES_DATA ${NOTES_PATH}/server < $INPUT |${SHELL_PATH}/log.sh $OUTPUT_LOG&
1> /dev/null 2>&1 &
cd $NOTES_DATA ${NOTES_PATH}/server |${SHELL_PATH}/log.sh $OUTPUT_LOG& 1> /dev/n
ull 2>&1 &
NOTESSRV.SH
#!/bin/sh
# Description
# start/stop Domino server
# 2005/05 Hitachi Software
######################
SHELL_PATH=/notesshell
NOTES_USER=fjflm104
NOTES_SERVER=fjflm104
STARTSH=$SHELL_PATH/startdomino.sh
STOPSH=$SHELL_PATH/stopdomino.sh
case "$1" in
'start')
if [ -x $STARTSH ]; then
echo "Starting Domino..."
/usr/bin/su - $NOTES_USER -c "$STARTSH $NOTES_USER $NOTES_SERVER"
else
echo "Cannot start Domino."
fi
;
'stop')
if [ -x $STOPSH ]; then
echo "Stopping Domino..."
/usr/bin/su - $NOTES_USER -c "$STOPSH $NOTES_USER $NOTES_SERVER"
else
echo "Cannot stop Domino."
fi
;
*)
echo "Usage: /notesshell/notessrv.sh { start|stop }"
;
esac
exit 0
STOPDOMINO.SH
#!/bin/sh
# Description
# shutdown Domino server
# 2004/05 Hitachi Software
################
if [ ! "$1" ] || [ ! "$2" ]
then
echo "Usage: stopdomino.sh NOTES_USER NOTES_SERVER"
exit 1
fi
##### Environment #####
##### Notes #####
NOTES_USER=$1
NOTES_SERVER=$2
NOTES_PATH=/opt/lotus/bin
##### Configuration Parameter #####
DELAY=600 # Notes Shutdown Delay (X second)
INTERVAL=10 # Shutdown Check Interval in Delay (X second)
##### Time Format(yymmdd@hhmmss) #####
TIME=`date +"%y%m%d@%H%M%S"`
##### Notes data directory
case "$NOTES_USER" in
'fjflm102')
NOTES_BASE=/notes1/fjflm102
'fjflm103')
NOTES_BASE=/notes2/fjflm103
'fjflm104')
NOTES_BASE=/notes/fjflm104
*)
echo "Notes user not exist"
exit 1
esac
NOTES_DATA=$NOTES_BASE/data
##### Log directory #####
LOG_PATH=$NOTES_BASE/log
EVENT_LOG=$LOG_PATH/event.log
OUTPUT_LOG=$LOG_PATH/domino.log
##### Shutdown Notes Server #####
cd $NOTES_DATA
${NOTES_PATH}/server -q 1> /dev/null 2>&1 &
##### if Domino server doesn't shutdown properly, kill manually
echo "wait\c"
STOP_NORMAL=1
COUNT=${INTERVAL}
while [ $COUNT -lt $DELAY ] do
pid=`ps -f -u ${NOTES_USER} | grep /65010/ | grep -v grep | nawk '{print $2}'`
if [ ! "${pid}" ] then
STOP_NORMAL=0
break
fi
sleep $INTERVAL
echo ".\c"
COUNT=`expr ${COUNT} + ${INTERVAL}`
done
echo ""
rm -f ~notes.lck
grep1="grep $NOTES_USER"
for i in `ps -ef | $grep1 | awk ' /65010/ && ! /awk/ {print $2}'`
do
echo "Killing notes process "$i
kill -9 $i
done
for i in ` ipcs | $grep1 | awk '/^m / {print $2}'`
do
echo "removing Shared Memory " $i
ipcrm -m $i
done
for i in ` ipcs | $grep1 | awk '/^s / {print $2}'`
do
echo "removing Semaphore " $i
ipcrm -s $i
done
for i in ` ipcs | $grep1 | awk '/^s / {print $1}'`
do
echo "removing Semaphore " $i
set n = `echo $i | cut -c2-`
ipcrm -s $n
done
for i in `ls -al /tmp | grep NOTESMEM | awk '/ '$NOTES_USER' / {print $9}'
`
do
echo "removing mmap " $i
rm -f /tmp/$i
done
echo "Domino Server shutdown completed."
# write to event log
SHUTDOWN_TIME=`date +"%y%m%d@%H%M%S"`
echo "$SHUTDOWN_TIME Domino server shutdown completed" >> $EVENT_LOG
##### Shutdown Check #####
if [ $STOP_NORMAL = 0 ]; then
exit 0
else
exit 1
fi
/等待/等待 |
|