#!/bin/sh
#
# Shell Script for Watching the Simph323-client
#
# Usage function
usage()
{
echo "Usage: $0 classname listen-port log-number"
echo "Example:"
echo " $0 2004060400006 1755 6"
echo ""
}
# Check input parameters
args=$#
if [ $args -ne "3" ]
then
usage
exit 1
fi
# Watch the simph323-client status
app="./simph323 -g 61.159.46.62 -u $1 -u $1#1 -a -l -i 61.159.46.63:$2"
port=$2
cout=0;
echo "$app"
while [ 1 ]
do
# Inquire if the process exist or not
rs=`ps -x | grep "$app" | grep -v "grep"`
# echo "rs = $rs"
if [ -z "$rs" ]
then
echo "`date "+%Y-%m-%d %H:%M:%S"` The process is not found !"
# Change port, and restart ...
if [ $port -eq $2 ]
then
port=`expr $port + 10`
else
port=$2
fi
app="./simph323 -g 61.159.46.62 -u $1 -u $1#1 -a -l -i 61.159.46.63:$port"
echo $app
sleep 1
$app 1>>$3.out 2>>$3.out &
cout=0
else
if [ $cout -eq "0" ]
then
echo "`date "+%Y-%m-%d %H:%M:%S"` The process is running ..."
else
if [ $cout -eq "59" ]
then
cout=0
continue
fi
fi
cout=`expr $cout + 1`
fi
sleep 1
done
#
# Shell Script for Watching the Simph323-client
#
# Usage function
usage()
{
echo "Usage: $0 classname listen-port log-number"
echo "Example:"
echo " $0 2004060400006 1755 6"
echo ""
}
# Check input parameters
args=$#
if [ $args -ne "3" ]
then
usage
exit 1
fi
# Watch the simph323-client status
app="./simph323 -g 61.159.46.62 -u $1 -u $1#1 -a -l -i 61.159.46.63:$2"
port=$2
cout=0;
echo "$app"
while [ 1 ]
do
# Inquire if the process exist or not
rs=`ps -x | grep "$app" | grep -v "grep"`
# echo "rs = $rs"
if [ -z "$rs" ]
then
echo "`date "+%Y-%m-%d %H:%M:%S"` The process is not found !"
# Change port, and restart ...
if [ $port -eq $2 ]
then
port=`expr $port + 10`
else
port=$2
fi
app="./simph323 -g 61.159.46.62 -u $1 -u $1#1 -a -l -i 61.159.46.63:$port"
echo $app
sleep 1
$app 1>>$3.out 2>>$3.out &
cout=0
else
if [ $cout -eq "0" ]
then
echo "`date "+%Y-%m-%d %H:%M:%S"` The process is running ..."
else
if [ $cout -eq "59" ]
then
cout=0
continue
fi
fi
cout=`expr $cout + 1`
fi
sleep 1
done