Hadoop作业在由cron调用时失败 [英] Hadoop job fails when invoked by cron
本文介绍了Hadoop作业在由cron调用时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了以下shell脚本来调用hadoop作业:
I have created the following shell script for invoking a hadoop job:
#!/bin/bash
/opt/hadoop/bin/hadoop jar /path/to/job.jar com.do.something <param-1> ... <param-n> &
wait %1
STATUS=$?
if [ $STATUS -eq 0 ]
then
echo "SUCCESS" | mailx -s "Status: "$STATUS -r "mail@mysite.com" "mail@mysite.com"
exit $STATUS
else
echo "FAILED" | mailx -s "Status: "$STATUS -r "mail@mysite.com" "mail@mysite.com"
exit $STATUS
fi
当我像下面这样手动运行上面的脚本:
When I run the above script manually like this:
$ ./path/to/job.sh
Hadoop作业成功执行并返回退出状态0 。
Hadoop job executes sucessfully and returns an exit status "0".
现在,为了每天自动执行作业,我配置了一个cron作业来运行上面的脚本:
Now, to automate the job execution everyday, I have configured a cron job to run the above script like this:
0 22 * * * /path/to/job.sh
b $ b
但是,现在工作没有提交到Hadoop,并且退出状态为1。
But, now job is not submitted to Hadoop and I get a exit status "1".
这里很少注意:
- 配置cron作业的用户帐户为UserA
- UserA也是Hadoop系统用户
- 该群集专用于运行此作业
- 脚本可执行
- The user account under which cron job is configured is UserA
- UserA is also Hadoop System User
- The cluster is dedicated for running this job
- The script is executable
我想知道为什么cron调用这个工作时没有运行。
I would like to know why the job is not running when cron invokes it ?
推荐答案
0 22 * * * /path/to/job.sh
0 22 * * * ./path/to/job.sh
是否有效?
这篇关于Hadoop作业在由cron调用时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文