|
|
下面是网通的自读文件:
1. 使用该客户端需要具备root权限. 并确认您的系统已经安装dhcp客户的软件包并且已经把网卡配置为动态获取ip地址的模式。确认系统安装的c共享库版本在2.3以上。
2. 安装: 将安装包解开到某个路径(用$dest_path表示,下面会引用该值,实际使用中,请替换为实际值)下即可
3. 环境变量设置: 为root用户增加一个环境变量RACERC指向该客户端的安装路径, 即$dest_path. 同时, 把$dest_path增加到root用户的PATH环境变量中.
如果使用bash, 则修改root用户根目录下的.bash_profile文件, 增加如下语句: export RACERC=$dest_path, 把$dest_path增加到PATH=...语句中.
4. 配置: 如果需要, 请修改racer.ini文件以调整Server1和Server2的值, Server1和Server2表示服务器的ip地址, 如果只有一个服务器ip地址, 则Server1和Server2的值都设置为该ip地址值.
5. 使用方法
客户端登录: $dest_path/racer/
查看状态: $dest_path/racer/ecou.sh status
客户端退出: $dest_path/racer/ecou.sh stop
照这上面所说的方法做了,在suse上我修改了/etc/profile文件重启后,执行登陆ecou.sh start,后提示下面的错误:
Unable to find process to run, try re-install your process again!
搞不明白,后来打开了ecou.sh文件,也找到了上面的提示语句,但是不知到什么原因造成的。现在求助广大fans
下面是ecou.sh文件的具体内容:
#!/bin/sh
EXCUTE_NAME="racer"
X_NAME="race"
verify_system()
{
#check if this is a linux platform, if not linux, alert and quit
if [ `uname` != "Linux" ]; then
echo "This process being available ONLY on Linux"
return 1
fi
#check if it's root, otherwise quit
if [ `whoami` != "root" ]; then
echo "No more than root has previlege to run this process"
return 1
fi
#check size of log file
if [ -f "ecou.log" ]; then
FSIZE=`du -ks ecou.log | awk '{print $1}'`
if [ $FSIZE -gt 1000 ]; then
>ecou.log #clear the log file
fi
else
>ecou.log
fi
return 0
}
find_ecou()
{
#FINDNUM=`ps -ef | grep "$EXCUTE_NAME" | grep -v grep | wc -l`
FINDNUM=`pgrep -nx "$EXCUTE_NAME" | wc -l`
if [ $FINDNUM -eq 0 ]; then
return 1
else
return 0
fi
}
start_ecou()
{
if find_ecou
then
echo "The pocess is running"
exit
fi
#to which interface link with Internet
INTERNUM=`ifconfig -a | grep "HWaddr" | wc -l`
if [ $INTERNUM -eq 0 ]; then
echo "No net Interface can be found, may you type command such as insmod and ifup eth0 first"
return 1
fi
#if more than ONE eth installed, have to select one
CMPNUM=0
if [ "$INTERNUM" -gt "$CMPNUM" ]; then
ifconfig -a | grep "HWaddr" | awk '
BEGIN {
i=0;
printf("All names of your net interface installed\n");
printf("-----------------------------------------\n");
}
{
printf("\t%s\t%d\n", $1, i);
i++;
}'
echo -n "Input one name to hace access with Internet (eth0): "
read INTERNAME
if [ ! $INTERNAME ]; then #default name is eth0
INTERNAME="eth0"
fi
#if the name input is correct or not
TMP_NUM=`ifconfig -a | grep "HWaddr" | grep "$INTERNAME" | wc -l`
if [ $TMP_NUM -eq 0 ]; then
echo "You have input an invalid name of net interface"
return 1
fi
else
INTERNAME=`ifconfig -a |grep "HWaddr" | awk '{print $1}'`
fi
echo "The name of interface is: " $INTERNAME
#okey, we have got correct env & parameters to run this process
#However, definitly necessary ini files as well as process file must be found
#in the same path
if [ ! -f "racer.ini" ]; then
echo "Warning: No relative file racer.ini found, re-creating"
echo "Server1=218.29.0.227" >racer.ini
echo "Server2=218.29.0.228" >>racer.ini
fi
if [ ! -f "$X_NAME" ]; then
echo "Unable to find process to run, try re-install your process again!"
return 1
fi
if [ ! -x "$X_NAME" ]; then
chmod +x $X_NAME
fi
if [ ! -L "$EXCUTE_NAME" ]; then
ln -s $X_NAME $EXCUTE_NAME
fi
./$EXCUTE_NAME $INTERNAME
RETVAL=$?
if [ ! $RETVAL -eq 0 ]; then
echo "Failed to run the process"
else
echo "$EXCUTE_NAME has been started successfully"
fi
return 0
}
#for help info
usage()
{
echo "Usage: $0 {[start]|[status]|[stop]}"
}
#to stop ecou
stop_ecou()
{
#ps -ef | grep "$EXCUTE_NAME" | grep -v grep | awk '{print $2}' | xargs kill -SIGINT 2>/dev/null
pgrep -nx "$EXCUTE_NAME" | xargs kill -SIGINT 2>/dev/null
FINDNUM=1
while [ ! $FINDNUM -eq 0 ]
do
#FINDNUM=`ps -ef | grep "$EXCUTE_NAME" | grep -v grep | wc -l`
FINDNUM=`pgrep -nx "$EXCUTE_NAME" | wc -l`
sleep 1
done
if [ $? -eq 0 ]; then
echo "The process has been halted successfully"
else
echo "Failed to terminate the process OR the process is not running"
fi
}
#to tell status
tell_status()
{
#ps -ef | grep "$EXCUTE_NAME" | grep -v grep | awk '{print $2}' | xargs kill -SIGUSR1 2>/dev/null
pgrep -nx "$EXCUTE_NAME" | xargs kill -SIGUSR1 2>/dev/null
if [ $? -eq 0 ]; then
return;
else
echo "No status returned for $EXCUTE_NAME"
fi
}
#main
PARAM_NUM=$#
if [ ! $PARAM_NUM -eq 1 ]; then
usage
exit
fi
if [ -n $RACERC ]; then
cd $RACERC
fi
if ! verify_system
then
exit
fi
case $1 in
start) start_ecou;;
status) tell_status;;
stop) stop_ecou;;
*) usage;;
esac |
|