Skip to content

Instantly share code, notes, and snippets.

@haiy
Created July 12, 2014 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haiy/cd7143155290f9df81a9 to your computer and use it in GitHub Desktop.
Save haiy/cd7143155290f9df81a9 to your computer and use it in GitHub Desktop.
收集yarn log
#!/bin/bash
log=/alidata1/data/hdfs/nodemanager_log
rsync -avc root@ZERONE-01:/alidata1/data/hdfs/nodemanager_log/ $log
current_dir=`pwd`
origin_log_dir=/alidata1/data/hdfs/nodemanager_log
cd $origin_log_dir
target_dir=`ls -t | head -n 1`
cd $origin_log_dir/$target_dir
rm stdout stderr
echo `pwd`
dirlst=`ls`
for d in $dirlst;
do
nm=$(echo $d | cut -d _ -f 5)
echo $d, $nm
echo "===================================" >> stdout
cat $d/stdout >> stdout
echo "===================================" >> stderr
cat $d/stderr >> stderr
done
cp stdout stderr $current_dir/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment