summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/checkXFSfrag.sh
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2017-11-29 20:39:45 (GMT)
committerBritney Fransen <brfransen@gmail.com>2017-11-29 20:39:45 (GMT)
commitfcae1055278374b01cc9b5e1c76237a3f49e1120 (patch)
tree463e4e48586ec9adda6691d6892225bc2a8e7c24 /abs/core/LinHES-system/checkXFSfrag.sh
parent60884ca433bf67e0ddd4da7688372715cdf3c7ea (diff)
downloadlinhes_pkgbuild-fcae1055278374b01cc9b5e1c76237a3f49e1120.zip
linhes_pkgbuild-fcae1055278374b01cc9b5e1c76237a3f49e1120.tar.gz
linhes_pkgbuild-fcae1055278374b01cc9b5e1c76237a3f49e1120.tar.bz2
LinHES-system: checkXFSfrag.sh: add --idle option that uses idle.py to check system idle before defrag
xfs_defrag.cron: use the --idle option of checkXFSfrag.sh
Diffstat (limited to 'abs/core/LinHES-system/checkXFSfrag.sh')
-rwxr-xr-xabs/core/LinHES-system/checkXFSfrag.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/checkXFSfrag.sh b/abs/core/LinHES-system/checkXFSfrag.sh
index 5fccece..d25eaa8 100755
--- a/abs/core/LinHES-system/checkXFSfrag.sh
+++ b/abs/core/LinHES-system/checkXFSfrag.sh
@@ -31,12 +31,22 @@ e='/usr/bin/echo -e' # Use the echo command, not
xfsfsr=/usr/bin/xfs_fsr # Set variable with the path to xfs_fsr.
xfsdb=/usr/bin/xfs_db # Set variable with the path to xfs_db.
ionice=/usr/bin/ionice # Set variable with the path to ionice.
+idle='/usr/LH/bin/idle.py -s' # Set varialbe with path to idle.py.
pctmax=12 # Set maxiumum frag percent needed for defrag.
# This is zero here for testing purposes only
# a higher number should be used in production.
array=`df -T|grep xfs|cut -f 1 --delim=" "` # Array of all XFS file systems.
for i in ${array[@]};
do
+ #check for idle flag
+ if [[ $1 == "--idle" ]]
+ then
+ while ! $idle
+ do
+ echo "System is busy. Waiting 10 minutes before trying again."
+ sleep 600
+ done
+ fi
#check that the device is SATA and skip defrag on SSDs
device=`echo ${i} | cut -f 3 --delim="/" | sed 's/[0-9]//g'`
isSATA=`cat /sys/block/${device}/queue/rotational`