Created 05-25-2016 07:19 PM
Hi,
I have a shell script in HDFS echo.sh, which contains
echo Hello
I want to execute the shell script from Unix shell as below.
sh <HDFS_SCRIPT_PATH>/echo.sh fails saying no such file.
Kindly let me know how can i do it.
Regards
Mamta Chawla
Created 05-25-2016 07:35 PM
There are 3 ways.
1. hadoop fs -cat /tmp/test.sh|exec sh
2. You can install HDP NFS and mount the hdfs directory on local file system from where you can execute your script.
3. You can write an oozie shell workflow and call your .sh HDFS file inside the workflow.
Created 05-25-2016 07:22 PM
are you using variables in the absolute path ?
you can test out the location of the file first. I am assuming <HDFS_SCRIPT_PATH> must be a path which is available on the system, something like /home/hdfs/echo.sh. If you want to ensure that it exists, you can try listing it, like "ls /home/hdfs/echo.sh". If it says that there is no such file or directory, you need to have the correct path and locate the actual location of this file.
Created 05-25-2016 07:24 PM
yes, we can't submit/run shell scripts directly from local.
we need tp set up NFS mount and give a try.
link for setting up NFS mount
Created 05-25-2016 07:34 PM
Ah, completely missed out the first line, indeed, we cannot execute a file thats inside HDFS.
Created 05-25-2016 07:35 PM
There are 3 ways.
1. hadoop fs -cat /tmp/test.sh|exec sh
2. You can install HDP NFS and mount the hdfs directory on local file system from where you can execute your script.
3. You can write an oozie shell workflow and call your .sh HDFS file inside the workflow.
Created 05-26-2016 03:45 PM
Hi @Mamta Chawla,
Please feel free to accept an answer which helped you, so that this thread can be closed. Thanks