Linux/Unix writing script/scripts

Linux/Unix Script to move a file from directory:

#moving the file from a directory
tdate=$(date +"%F")
export userchk=`whoami`
if [[ $userchk != "username" || $userchk != "username" ]]; then
echo "ERROR: This script must be executed as application owner only!!"
exit 1
fi
read -p "ORACLE HOME check - Please type Yes/Y/y if OK : $OHS_HOME " userans
if [[ $userans == "Y" || $userans == "y" || $userans == "yes" || $userans == "Yes" ]]; then
cd $OHS_HOME/cgi-bin
mv test-cgi test-cgi_$tdate
else
echo "Did not get the expected input so Exited"
fi

check if a particular port is open:

lsof -Pi :5556 -sTCP:LISTEN|awk 'FNR == 2 {print $9}'|wc -l

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!