|
Last change
on this file since 14905 was 14759, checked in by Daniela Dorner, 13 years ago |
|
adapted mountpoints for dl00
|
-
Property svn:executable
set to
*
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | # Script to check whether disk is full
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | # possible limits
|
|---|
| 7 | limits=( 209715200 524288000 1073741824 2147483648 )
|
|---|
| 8 | texts=( "200 GB" "500 GB" "1 TB" "2 TB" )
|
|---|
| 9 |
|
|---|
| 10 | # set standard limits
|
|---|
| 11 | lowlimit=1
|
|---|
| 12 | highlimit=2
|
|---|
| 13 |
|
|---|
| 14 | # get paths depending on host
|
|---|
| 15 | case $HOSTNAME in
|
|---|
| 16 | data) dirs=( "/loc_data" "/daq" "/newdaq" )
|
|---|
| 17 | ;;
|
|---|
| 18 | daq) dirs=( "/raid10" )
|
|---|
| 19 | ;;
|
|---|
| 20 | isdc-dl00) dirs=( "/gpfs" "/scratch" )
|
|---|
| 21 | highlimit=1
|
|---|
| 22 | # better: array of limits
|
|---|
| 23 | ;;
|
|---|
| 24 | *) echo "no valid host "$HOSTNAME
|
|---|
| 25 | exit
|
|---|
| 26 | ;;
|
|---|
| 27 | esac
|
|---|
| 28 |
|
|---|
| 29 | # get current hour
|
|---|
| 30 | hour=`date +%k`
|
|---|
| 31 |
|
|---|
| 32 | # define disk space limit for check depending on the time
|
|---|
| 33 | if [ $hour -lt 8 ] || [ $hour -gt 15 ]
|
|---|
| 34 | then
|
|---|
| 35 | # during night
|
|---|
| 36 | dulimit=${limits[$lowlimit]}
|
|---|
| 37 | dutext=${texts[$lowlimit]}
|
|---|
| 38 | else
|
|---|
| 39 | # during day
|
|---|
| 40 | dulimit=${limits[$highlimit]}
|
|---|
| 41 | dutext=${texts[$highlimit]}
|
|---|
| 42 | fi
|
|---|
| 43 |
|
|---|
| 44 | for dir in ${dirs[@]}
|
|---|
| 45 | do
|
|---|
| 46 | # check if directory is mounted (check if empty)
|
|---|
| 47 | if [ "$(ls -A $dir)" ]
|
|---|
| 48 | then
|
|---|
| 49 | # get available disk space
|
|---|
| 50 | diskusage=( `df -P $dir | grep $dir ` )
|
|---|
| 51 | # check if more than X GB are left on /loc_data
|
|---|
| 52 | if [ ${diskusage[3]} -lt $dulimit ]
|
|---|
| 53 | then
|
|---|
| 54 | echo "WARN less than "$dutext" left on "$dir" on node "$HOSTNAME
|
|---|
| 55 | df -h $dir
|
|---|
| 56 | echo ""
|
|---|
| 57 | fi
|
|---|
| 58 | else
|
|---|
| 59 | echo "ERROR "$dir" seems to be not mounted."
|
|---|
| 60 | fi
|
|---|
| 61 | done
|
|---|
| 62 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.