i have a "if .. then exit end " in s shell script on remote servers.
now the connection to the remote server got killed after i run this script on the remote servers. How do i run this script on remote hosts and still keep remote connections alive after executing the script.
....
if [ $# -le 0 ]
then
echo "Usage: $0 product_name APPLICATION_ID"
exit 1
fi
....
It works fine and will keep staying on remote servers on old environment , but the connections got killed when i run the same script on a new environment.
the purpose of this code is checking parameter existence. if we do not pass any parameter to this script, the script will terminate and print ....Usage:
if [ $# -le 0 ]
then
echo "Usage: $0 product_name APPLICATION_ID"
exit 1
fi
-------------------------
also i have update the code to
echo "\$# value is : " $#
if [ $# -ne 1 ]
then
echo "Usage: $PROG hostname"
#exit 0
echo " exit 1 "
fi
$>. sync_af
$# value is : 0
Usage: hostname
exit 1
==============
It works on old data centers. but not on new data center .
thank you
---------- Post updated at 02:51 PM ---------- Previous update was at 02:44 PM ----------
$> check_df
#!/bin/ksh
# This script checks the percentage of disk usage
# and will send an email if disk usage is more than 80%(default).
# You can reset the threshold by assigning a value to threshold variable @ line 19
CURDIR=`dirname $0`
. $CURDIR/commands
if [ $# -le 0 ]
then
echo "Usage: $0 product_name APPLICATION_ID"
exit 1
fi
SERVER=$1
PROGRAM=`basename $0`
PROG="${2}+$PROGRAM"
typeset -i threshold=80
typeset -i USAGE
tmpfile=/home/dba/oracle11g/amreview/bin/$PROGRAM.$$.tmp
touch $tmpfile
for Disk in `df -P| grep '%' | grep '^/' | awk '{print $6}'`
do
INFO=`/bin/df -h -P $Disk| awk '{print $5,$6}'`
INFO=`echo $INFO | awk '{print $3,$4}'`
USAGE=`echo $INFO | cut -d% -f1`
if (( USAGE > threshold ))
then
echo "Warning :DISC usage :$INFO " >>$tmpfile
fi
done
if [ -s $tmpfile ]
then
$CURDIR/writelog -p $PROG -s 4 -S $SERVER -f $tmpfile
fi
/bin/rm $tmpfile
You posted faster than me...
that is what I supposed to be the culprit and you just comfort me it is that,
dot space program means replacing your current shell ( logging shell here ) by the program/shell script - once it ends it exits you from your session...