On 30/07/2015 19:31, sutanu....@gmail.com wrote:
#!/bin/bash
_maillist='pa...@email.com'
_hname=`hostname`
_logdir=/hadoop/logs
_dirlog=${_logdir}/directory_check.log
_year=$(date -d "-5 hour" +%Y)
_month=$(date -d "-5 hour" +%m)
_day=$(date -d "-5 hour" +%d)
_hour=$(date -d "-5 hour" +%H)
_hdfsdir=`hdfs dfs -ls -d /hadoop/flume_ingest_*/$_year/$_month | awk '{print
$8}'`
echo "Checking for HDFS directories:" > ${_dirlog}
echo >> ${_dirlog}
for _currdir in $_hdfsdir
do
hdfs dfs -ls -d $_currdir/$_day/$_hour &>> ${_dirlog}
done
if [[ `grep -i "No such file or directory" ${_dirlog}` ]];
then
echo "Verify Flume is working for all servers" | mailx -s "HDFS Hadoop Failure on
Flume: ${_hname}" -a ${_dirlog} ${_maillist}
fi
Read the documentation here https://docs.python.org/3/ and then run up
your favourite editor and start typing. When and if you hit problems
come back with a snippet of code that shows the problem, what you
expected to happen, what actually happened, and the full traceback if
there is one. Please use cut and paste to ensure that you get the data
correct.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list