Shell nodes support the standard shell syntax but not interactive syntax.
Background information
You can run Shell nodes only on exclusive resource groups for scheduling. For more information, see Create and use an exclusive resource group for scheduling.
A Shell node that is run on an exclusive resource group for scheduling may need to
access a data source for which a whitelist is configured. In this case, you must add
the required information about the resource group to the whitelist of the data source.
For more information, see Create and use an exclusive resource group for scheduling.
Procedure
- Move the pointer over the
icon and choose . Alternatively, you can click the name of the desired workflow in the Business Flow
section, right-click General, and then choose .
- In the Create Node dialog box, configure the Name and Path parameters.
Note The node name must be 1 to 128 characters in length and can contain letters, digits,
underscores (_), and periods (.).
- Click Commit.
- Configure the Shell node.
- Write SQL statements for the Shell node.
To use scheduling parameters for the Shell node, write the SQL statements in the following
format:
echo "$1 $2 $3"
Note Separate multiple parameters with spaces. Example:
Parameter1 Parameter2. For more information about scheduling parameters, see
Overview of scheduling parameters.
- In the top toolbar, click the
icon to save the SQL statements.
- In the top toolbar, click the
icon to execute the SQL statements. If you want to use another resource group to test the Shell node on the
DataStudio page, click the

icon in the toolbar and select the exclusive resource group that you want to use.
- On the configuration tab of the Shell node, click the Properties tab in the right-side navigation pane and configure scheduling properties for the
node. For more information, see Configure basic properties.
- Save and commit the node.
Notice You must configure the Rerun and Parent Nodes parameters on the Properties tab before you commit the node.
- Click the
icon in the top toolbar to save the node.
- Click the
icon in the toolbar.
- In the Commit Node dialog box, configure the Change description parameter.
- Click OK.
If the workspace that you use is in standard mode, you must click
Deploy in the upper-right corner to deploy the node after you commit it. For more information,
see
Deploy nodes.
- Perform O&M operations on the node. For more information, see O&M overview of auto triggered nodes.
- Determine whether the Shell script is successfully run.
The exit code of the Shell script determines whether the Shell script is successfully
run. Exit codes:
- 0: indicates that the Shell script is successfully run.
- 1: indicates that the Shell script is terminated.
- 2: indicates that the Shell script needs to be automatically rerun.
- Other exit codes: indicate that the Shell script failed to be run.
For a Shell script, if the first command is an invalid command, an error is returned.
If a valid command is run after the invalid command, the Shell script can be successfully
run. Example:
#! /bin/bash
curl http://xxxxx/asdasd
echo "nihao"
The Shell script is successfully run because the script exited as expected.
If you change the previous script to the following script, a different result is returned.
Example:
#! /bin/bash
curl http://xxxxx/asdasd
if [[ $? == 0 ]];then
echo "curl success"
else
echo "failed"
exit 1
fi
echo "nihao"
In this case, the script fails to be run.
- Run an ODPS node in the Shell script.
Command that is used to run an ODPS node:
/opt/taobao/tbdpapp/odpswrapper/odpsconsole/bin/odpscmd -u {accessId} -
p {accesskey} --project=xxxx --endpoint=xxxxx -e "SQL statements"
For more information about the endpoints, see Endpoints.