我正在使用以下脚本从 Hive 数据库中获取 CREATE TABLE 语句。
该脚本在命令提示符下运行良好,但是当尝试使用 nohup 执行作业时,会在运行 /usr/bin/hive
的行处停止。
有人可以帮忙吗?
#!/bin/bash
rm -f tableNames_List.txt
rm -f HiveTableDDL_List.txt
hive --showHeader=false --silent=true --outputformat=csv2 -e "use devinstance"
hive --showHeader=false --silent=true --outputformat=csv2 -e "use devinstance;show tables;" > tableNames_List.txt
wait
cat tableNames_List.txt | while read LINE
do
/usr/bin/hive -e "use devinstance;show create table \`$LINE\`" >> HiveTableDDL_List.txt
echo -e "; \n" >> HiveTableDDL_List.txt
done
echo "Table DDL generated"