Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- src=`hdfs dfs -ls /data/logs-gobblin-tmp/ | tr -s ' ' | cut -d' ' -f8 | tail -n +2 | head -n 1`
- while read -r src_path
- do
- TOPIC=`echo $src_path | sed 's/\/data\/\<logs-gobblin-tmp\>\///'`
- CAMUS="/data/logs/${TOPIC}/2017/02"
- GOBBLIN="${src_path}/2017/02"
- CAMUS_DAY=$CAMUS/15
- GOBBLIN_DAY=$GOBBLIN/15
- TMP=/tmp/camus_backup/$TOPIC
- echo "Creating tmp $TMP"
- hdfs dfs -mkdir -p $TMP
- echo "Moving $TOPIC from $CAMUS_DAY to $TMP/"
- hdfs dfs -mv $CAMUS_DAY $TMP/
- echo "Moved out $TOPIC from camus. Moving $GOBBLIN_DAY to $CAMUS/"
- hdfs dfs -mv $GOBBLIN_DAY $CAMUS/
- echo "Finished $TOPIC"
- done <<< "$src"
Advertisement
Add Comment
Please, Sign In to add comment