home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
UAGENT
/
root
/
usr
/
lib
/
uagent
/
uagent
< prev
next >
Wrap
Text File
|
1998-08-19
|
6KB
|
287 lines
#!/bin/sh
# Uagent Administration Menus
# Cheyenne Software Inc.
#
# OS: UnixWare 2.x
#
# Date: 01/12/94 (JH)
# 1. Uagent v3.0 (supports ARCserve/Open)
#
# Date: 08/06/93 (JH)
# 1. add a flag to specify Follow_Symbolic_Link or not, which is
# determined by the existence of file $UAGBIN/uagent/follow.symlink.
#
# Usage: uagent [start [-p <tcp port#>] [follow] | stop | status | follow | notfollow]
#
# Date: 9/28/92 (JH)
# 1. change 'arcagent' to 'uagentd'
# 2. path for 'uagentd' ($UAGBIN) is determined at installation
#
# Date: 4/19/92 (PL)
#
#menu# uagent [start [-p <tcp port#>] | stop | status]
#help# start will start UAGENT.
#help# stop will stop UAGENT.
#help# status will tell you if UAGENT is running.
UAGBIN="/usr/lib"
FOLLOW="$UAGBIN/uagent/follow.symlink"
IPCFILE="$UAGBIN/uagent/LOG/uag.ipc"
ARGS="$*"
PSFLAG="-aef"
PSCUT="-c9-14"
usage()
{
echo "\nUsage:"
echo " uagent start [-b <bufsz>] [-m <maxbuf>] [-v] [-l] [-n]"
echo " [-s async|nonblocking] [-a <n>] [-s <bufsz>] [-t] [-S] [-e]"
if [ "$1" = "" ]
then
echo " uagent {status | stop}"
fi
echo "\n -b <bufsz>: I/O buffer size in bytes (1024..8192)"
echo " -m <maxbuf>: # of buffers allocated for I/O (10..1024)"
echo " -s <bufsz>: specify socket buffer size in bytes (4096..65536)"
echo " -s <async|nonblocking>: set socket I/O to asynchronus/nonblocking mode"
echo " -v: verbose mode"
echo " -l: check all file locks [mandatory locks only]"
echo " -n: backup NFS mount directories"
echo " -t: will not reset file access time after backup"
echo " -a <n>: acknowledge for every n packets [0:no ack.]"
echo " -S: Single user mode"
echo " -e: backup will not traverse across file system"
echo "\n[ ]: default values",
exit 1
}
getparm1() {
if [ "$2" = "" ]
then
usage start
fi
parms="$parms $1 $2"
}
getparm() {
parms="$parms $1"
}
check_uagent()
{
pid=`ps $PSFLAG | grep uagentd | grep -v "grep uagentd" | cut $PSCUT`
}
kipc()
{
#set -x
if [ -f $IPCFILE ]
then
cat $IPCFILE | while read A B
do
#echo A=$A B=$B
if [ "$A" != "0" ]
then
case $A in
s|m)
# echo "ipcrm -$A $B > /dev/null 2>&1"
ipcrm -$A $B > /dev/null 2>&1;;
*)
;;
esac
fi
done
#echo "rm $IPCFILE"
rm $IPCFILE
fi
}
uid=`id | cut -d'=' -f2 | cut -d'(' -f1`
case "$1" in
notfollow)
check_uagent
if [ "$pid" = "" ]
then
echo "\nUAGENT is not started. Please start uagent first.\n"
exit 0
fi
if [ $uid = 0 ]
then
if [ -f $FOLLOW ]
then
rm $FOLLOW
fi
echo "\nUAGENT does NOT follow symbolic links...\n"
else
echo "\nOnly system administrator can change the state of following symbolic links.\n"
exit 0
fi
;;
follow)
check_uagent
if [ "$pid" = "" ]
then
echo "\nUAGENT is not started. Please start uagent first.\n"
exit 0
fi
if [ $uid = 0 ]
then
touch $FOLLOW && chmod 700 $FOLLOW && echo "\nUAGENT follows symbolic links...\n"
else
echo "\nOnly system administrator can change the state of following symbolic links.\n"
exit 0
fi
;;
start)
if [ "$2" = "?" ]
then
usage start
fi
if [ $uid = 0 ]
then
check_uagent
if [ "$pid" != "" ]
then
echo "\nUAGENT already started.\n"
exit 0
fi
# Load the Portable Streams Environment for TLI drivers (AIX only)
# set -x
# PSE=`strload -q | grep no`
# if [ "$PSE" != "" ]
# then
# strload
# fi
#
parms=""
#
# set arguments, put an extra argument 'uagent' to prevent flags from
# mingled with set.
#
set uagent $ARGS
while [ "$3" != "" ]
do
#echo [$3]
case "$3" in
notfollow) ;;
follow) parms="$parms -f" ;;
-p) getparm1 $3 $4
#
# on DEC, we need to re-set the arguments after return from a proceudre
#
set uagent $ARGS
shift
ARGS="$*"
;;
-b) getparm1 $3 $4
set uagent $ARGS
shift
ARGS="$*"
;;
-m) getparm1 $3 $4
set uagent $ARGS
shift
ARGS="$*"
;;
-a) getparm1 $3 $4
set uagent $ARGS
shift
ARGS="$*"
;;
-s) getparm1 $3 $4
set uagent $ARGS
shift
ARGS="$*"
;;
-n) getparm $3
set uagent $ARGS
;;
-f) getparm $3
set uagent $ARGS
;;
-v) getparm $3
set uagent $ARGS
;;
-l) getparm $3
set uagent $ARGS
;;
-t) getparm $3
set uagent $ARGS
;;
-S) getparm $3
set uagent $ARGS
;;
-e) getparm $3
set uagent $ARGS
;;
*) usage start ;;
esac
shift 2
ARGS="$*"
set uagent $ARGS
done
$UAGBIN/uagent/uagentd $parms
if [ "$?" = "0" ]
then
echo "\nUAGENT started...\n"
else
echo "\nFailed to start UAGENT.\n"
fi
else
echo "\nOnly system administrator can start UAGENT\n"
exit 0
fi
;;
stop)
if [ $uid = 0 ]
then
check_uagent
if [ "$pid" = "" ]
then
echo "\nUAGENT already stopped.\n"
else
echo "\nShutting down UAGENT process...\c"
kill -15 $pid >/dev/null 2>/dev/null
echo "Down.\n"
kipc
fi
else
echo "\nOnly system administrator can stop UAGENT\n"
exit 0
fi
;;
status)
# msk=`grep umask /etc/profile | cut -f1 | cut -d' ' -f2`
# if [ "$msk" = 077 -a $uid != 0 ] # C2
# then
# echo; echo "Only system administrator can check the status of UAGENT"; echo
# exit 0
# fi
echo "\nChecking the UAGENT process...It is \c"
check_uagent
if [ "$pid" = "" ]
then
echo "STOPPED.\n"
else
if [ -f $FOLLOW ]
then
echo "RUNNING & FOLLOWING symbolic links.\n"
else
echo "RUNNING & NOT following symbolic links.\n"
fi
fi
;;
*)
usage
exit 1
;;
esac
exit 0