问题描述
我试图使用以下脚本列出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
当我使用::
,但是在使用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执行的脚本中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!