Last change
on this file since 13771 was 13578, checked in by Daniela Dorner, 13 years ago |
added check if directory is mounted
|
-
Property svn:executable
set to
*
|
File size:
1.3 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" )
|
---|
17 | ;;
|
---|
18 | daq) dirs=( "/raid10" )
|
---|
19 | ;;
|
---|
20 | isdc-dl00) dirs=( "/fact" "/scratch" )
|
---|
21 | highlimit=3
|
---|
22 | ;;
|
---|
23 | *) echo "no valid host "$HOSTNAME
|
---|
24 | exit
|
---|
25 | ;;
|
---|
26 | esac
|
---|
27 |
|
---|
28 | # get current hour
|
---|
29 | hour=`date +%k`
|
---|
30 |
|
---|
31 | # define disk space limit for check depending on the time
|
---|
32 | if [ $hour -lt 8 ] || [ $hour -gt 15 ]
|
---|
33 | then
|
---|
34 | # during night
|
---|
35 | dulimit=${limits[$lowlimit]}
|
---|
36 | dutext=${texts[$lowlimit]}
|
---|
37 | else
|
---|
38 | # during day
|
---|
39 | dulimit=${limits[$highlimit]}
|
---|
40 | dutext=${texts[$highlimit]}
|
---|
41 | fi
|
---|
42 |
|
---|
43 | for dir in ${dirs[@]}
|
---|
44 | do
|
---|
45 | # check if directory is mounted (check if empty)
|
---|
46 | if [ "$(ls -A $dir)" ]
|
---|
47 | then
|
---|
48 | # get available disk space
|
---|
49 | diskusage=( `df -P $dir | grep $dir ` )
|
---|
50 | # check if more than X GB are left on /loc_data
|
---|
51 | if [ ${diskusage[3]} -lt $dulimit ]
|
---|
52 | then
|
---|
53 | echo "WARN less than "$dutext" left on "$dir" on node "$HOSTNAME
|
---|
54 | df -h $dir
|
---|
55 | echo ""
|
---|
56 | fi
|
---|
57 | else
|
---|
58 | echo "ERROR "$dir" seems to be not mounted."
|
---|
59 | fi
|
---|
60 | done
|
---|
61 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.