Fix "not found Execution failed with exit code 127" Error while executing shell scripts that call another shell script.

Follow

Shashank Srivastava -

Issue

You have created some Rules & have placed some shell scripts that are to be executed while deploying your Application package. For example, you have a shell script called OS_Status.sh.ftl inside your XLD_HOME/ext/scripts directory. This script calls another shell script called ping.sh. This ping.sh script lies in /tmp. You have setup your Rules so that OS_Status.sh.ftl is executed when you deploy your Application package. It means OS_Status.sh.ftl will also call ping.sh while deployment. But, XLD throws an error that ping.sh was not found & failed with exit code 127.

Environment

XL Deploy

Resolution

Convert your shell script(s) that is/are inside XLD_HOME/ext/scripts to a Unix/Unix like format by using a Linux utility dos2unix. It only works if you have your XLD running on a Linux server.

It will change the file encoding so that it is suited for execution on Linux platforms. Below is how to do it : -

root@shashank-server:/tmp# dos2unix ~shashank/xld/server/xl-deploy-6.0.2-server/ext/scripts/OS_Status.sh.ftl
dos2unix: converting file /home/shashank/xld/server/xl-deploy-6.0.2-server/ext/scripts/OS_Status.sh.ftl to Unix format ...

If this utility is not installed, install it using your package manager.

If your XLD is running on Windows, you can use Notepad++ to convert CRLF to LF. Follow below screenshots to see how to do it.

Text_file_with_CRLF.png

Conversion_to_LF.png

Converted_to_LF.png

Cause

This happens most commonly when you create your shell scripts on a Windows platform using Notepad but your deployment platform is Linux. Files created on Windows platforms have a concept of CRLF (Carriage Return Line Feed) but Linux files have LF only. So, the shell scripts created on Windows might not be read properly by Linux. dos2unix/Notepad++ removes the CR part & makes files compatible with Unix/Unix like platforms.

Additional Information

More information can be had from https://en.wikipedia.org/wiki/Newline 

Tags

xl-deploy, xld, encoding, scripts, exit code, how to, troubleshooting, kb

Have more questions? Submit a request
Powered by Zendesk