简体   繁体   English

echo map 使用 oozie 减少 shell 脚本中的 output

[英]echo map reduce output in shell script using oozie

The.sh script has the following content inside it .sh 脚本里面有以下内容

echo hbase org.apache.hadoop.hbase.mapreduce.RowCounter TABLE_NAME

The above script will be called by oozie which will capture whatever output the above command emits.上面的脚本将由 oozie 调用,它将捕获上面命令发出的任何 output。 The problem is, the above command is executed and no output gets echoed since all the output is happening in the background.问题是,执行了上述命令并且没有 output 得到回显,因为所有 output 都在后台发生。 How to capture those background output and echo it using shell script?如何捕获那些背景 output 并使用 shell 脚本回显它?

First thing first, you need to have <capture-output/> in the Oozie Shell action.首先,您需要在 Oozie Shell 操作中有<capture-output/>

Also to capture the output in Oozie shell action, the script need to be something like the following:此外,要在 Oozie shell 操作中捕获 output,脚本需要类似于以下内容:

set var=`hbase org.apache.hadoop.hbase.mapreduce.RowCounter TABLE_NAME`
echo "capture_var=$var"

After you do this, the variable will be available to be passed/used within Oozie using: ${wf:actionData('shellscriptoozieactionname')['capture_var']}完成此操作后,该变量将可用于在 Oozie 中传递/使用: ${wf:actionData('shellscriptoozieactionname')['capture_var']}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM