source: trunk/DataCheck/Monitoring/CheckDU.sh@ 17284

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