inotify 监控文件系统操作
path0=
path1=
########################################################
dir2watch1=/home/nanjing2/GridON
cd $path1;
inotifywait -mrq --exclude '^.*\.(fastq|txt)$' --timefmt '%d/%m/%y/%H:%M' --format '%T %w %f %e' -e create $dir2watch1 |while read event;
do DIR_detected=`echo $event|awk '$3!="/home/nanjing2/GridON/" && $3~/^.myConfig.R/ && $4=="CREATE"{print $2}'`;
if [[ -d $DIR_detected ]]; then
echo "$DIR_detected";
DIR=`echo "$DIR_detected"|awk -F '/' '{print $(NF-1)}'`
sleep 1;
nohup Rscript $path0/***.R $DIR_detected $path1 8 7200 1200 > $path1/log/$DIR.nohup.log 2>&1 &
fi
done;