onlyforbopi
9/17/2018 - 7:02 AM

LINUX.READYAPPS

  1. sizereport/sizereportadv
  2. monitordiskspace
  3. wordsearchindir
  4. CutSortRdupl

# Sort, print only duplicate fields
cut -c 1-11 MASTER_OLD.xstY | sort -n | uniq -d  > out.out.srt.ALL.txt

# Sort reverse, print only duplicate fields
cut -c 1-11 MASTER_OLD.xstY | sort -nr | uniq -d  > out.out.srt.ALL.txt

# Sort normal, print ALL duplicate fields
cut -c 1-11 MASTER_OLD.xstY | sort -n | uniq -D  > out.out.srt.ALL.txt

# Sort normal, count all duplicate fields.
cut -c 1-11 MASTER_OLD.xstY | sort -n | uniq -c  > out.out.srt.ALL.txt
#!/bin/bash



pattern_in=$1
parent_dir=$2

grep -nr "$pattern_in" $parent_dir
#!/bin/bash


################################################################
# Constants
readonly       THIS_JOB=${0##*/}
readonly       ARGS_NBR=0
readonly       ALERT=80

# declare -x  mrecipients="p.doulgeridis@dei.com.gr"
# declare -x  msender="K.Athanasopoulos@dei.com.gr"
# declare -x  mtitle="DISK USAGE NOTIFICATION"
# declare -x  ccrecipients="i.niarchos@dei.com.gr,p.doulgeridis@dei.com.gr" 




# declare -x  mrecipients="p.doulgeridis@dei.com.gr"
# declare -x  msender="K.Athanasopoulos@dei.com.gr"
# declare -x  mtitle="DISK USAGE"
# declare -x  ccrecipients="p.doulgeridis@dei.com.gr"

declare -x  mrecipients="p.doulgeridis@dei.com.gr,K.Athanasopoulos@dei.com.gr"
declare -x  msender="tee@dei.com.gr"
declare -x  mtitle="DISKSPACE_ERROR"
declare -x  ccrecipients="p.doulgeridis@dei.com.gr,a.pavlidis@dei.com.gr,i.niarchos@dei.com.gr" 

function usage(){

	echo " Script : $THIS_JOB called as :"
	echo " $THIS_JOB <DATE>"
	echo " Date must be in the format YYMMDD "
	echo " Script will search for the lines of FILTER (2 fields) and "
	echo " find matches in FILE_INPUT, then email."
	echo

}




function chk_abnd_silent()
{
  local     abnd
  
  abnd=$1
  # date
  if [ $abnd -ne 0 ]; then
    echo "Failed with status " $abnd; echo
    #rm +++++++++++++
    exit $abnd
    #return $abnd
  # else
    # echo "Done"; echo
  fi
}
#


# Check arguments
function chk_args()
{
  local        nbr_args=$1
  
  if [ $nbr_args -ne $ARGS_NBR ]; then
      echo "Wrong number of parameters = " $nbr_args
      usage
	  exit 69
  else
	 #echo "User has supplied the correct number of arguments"
     return 0
  fi
}


#################################################################
# Script start.
# echo $THIS_JOB " start time at `date` "; echo
# echo "-"

# Check number of arguments
#chk_args $#

# Run continuously

df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
#echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $ALERT ]; then
	echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" | mailx -S smtp=holhub -r $msender -s $mtitle -c $ccrecipients -v $mrecipients
   #sleep 2
fi
done



#echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" | mailx -S smtp=holhub -r $msender -s $mtitle -c $ccrecipients -v $mrecipients  
#############################
#!/bin/bash

dir_in=$1
echo $dir_in
cd $dir_in

du -k ENDXJOB/ | sort -nr | cut -f2 | xargs -d '\n' du -sh

#############################
#!/bin/bash

#!/bin/bash

dir_in=$1
echo $1
cd $dir_in


perl -e'%h=map{/.\s/;99**(ord$&&7)-$`,$_}`du -h`;die@h{sort%h}'