gpt4 book ai didi

shell - 如何从 shell 脚本顺序调用 Pig 脚本

转载 作者:可可西里 更新时间:2023-11-01 16:31:41 26 4
gpt4 key购买 nike

我在文件中有 Pig 脚本序列,我想从 Shell 脚本中执行它它执行 pig 脚本 sqeuenciatly。

例如:

sh script.sh/it/provider/file_name PIGddl.txt

假设 PIGddl.txt 有像这样的 Pig 脚本

  1. 记录数
  2. 无效验证等

如果所有 Pig 查询都在一个文件中,那么如何从 Shell 脚本执行 pig 脚本?

最佳答案

下面的想法可行,但如果您想要顺序流程,例如如果 1 执行则执行 2 否则执行 3 种流程,您可以使用 Oozie 来运行和调度作业。

#!/bin/sh
x=1
while [ $x -le 3 ]
do

echo "pig_dcnt$x.pig will be run"

pig -f /home/Scripts/PigScripts/pig_dcnt$x.pig --param timestamp=$timestamp1

x=$(( $x + 1 ))

done

关于shell - 如何从 shell 脚本顺序调用 Pig 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28960443/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com