HBase命令在通过crontab执行的脚本中不起作用 [英] Hbase commands not working in script executed via crontab

查看:158
本文介绍了HBase命令在通过crontab执行的脚本中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用以下脚本列出hbase中存在的表集:

I was trying to list the set of tables present in the hbase using the below script:

#!/bin/bash
/home/user/hbase-1.2.4/bin/hbase shell << eof > /home/user/myfile.txt
list 'RAW_5_.*'
eof

当我使用::


sh script.sh 在bash终端中运行脚本时,我可以获得表列表。 p>

sh script.sh

,但是在使用crontab运行时会创建一个0kb的文件。我已经给出了hbase的绝对路径。

, but its creating a 0kb file while running using the crontab. I have given the absolute path for the hbase.

有人可以帮助解决这个瓶颈吗?

Can anyone help on this bottleneck please?

推荐答案

由于它是从终端正确执行的,而不是在crontab中执行,因此请尝试在脚本中加载用户bash配置文件,而不是#!/ bin / bash 即,

Since it is executing properly from terminal and not in crontab, try loading user bash profile in the script instead of #!/bin/bash ie,

更改

#!/bin/bash

. ~/.bash_profile

通常#!/ bin / bash 包含在 bash_profile 中,并且还将具有用户特定的配置。

Usually #!/bin/bash is included in bash_profile and it will have user specific configurations as well.

这篇关于HBase命令在通过crontab执行的脚本中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆