edit-icon download-icon

SHELL task

Last Updated: Apr 10, 2018

SHELL tasks support standard SHELL syntax, but do not support the interactive syntax. SHELL tasks can run on the default resource group. If you want to access the IP address/domain name, add the IP address/domain name to the whitelist in Project Management > Project Configuration.

Procedure

Create SHELL nodes

  1. On the Data Development page, click New and select Create Task.

  2. Complete the configurations in the Create Task dialog box. In this example, select Node Task as the task type, SHELL as the type, and Periodic Scheduling as the scheduling type.

    TaskExample

  3. Click Create after completing the configurations.

Edit SHELL nodes

If you want to call the System Scheduling Parameters in SHELL, do as follows.

The SHELL statement is as follows.

  1. echo "$1 $2 $3"

Note:

Parameter 1 Parameter 2… Multiple parameters are separated by spaces. For more information on the usage of system scheduling parameters, see System scheduling parameters.

Test SHELL tasks

Two methods are available to test SHELL tasks: page direct Run and Test Run.

The differences between the two methods are as follows.

  • Run: When you click Run on the page, the task is performed on the default resource group. If a running environment is required when the task is running, a test run is recommended.

    For example, when calling pyodps by SHELL, you need to prepare the dependencies required by pyodps on your machine, and specify the task to run on your machine.

  • Test Run: The test run task generates an instance and supports running on the specified resource group. If a running environment is required when the task is running, a test run is recommended.

    Note:

    To run the task on a specified resource group, enter the O&M Center > Task Management page, select the task and click Modify Resource Group. Then, the task can run on the specified machine.

Run

  1. After you click Run on the page, a dialog box appears.

    RunSHELL

  2. Click Set Up to redirect to the configuration page, and then click Add.

    AddWhiteList

    Note:

    You can enter a domain name/IP address and port when adding the whitelist. Default resource group can directly access the added IP address/domain name.

  3. Switch back to the Data Development page, and click Run to view the results.

    Note:

    System scheduling parameters can only be replaced in the scheduling system. The parameter is not submitted to the scheduling system when you click Run on the page, so $3 is replaced with 0.

Test Run

  1. After you click Test Run on the page, a dialog box appears.

    TestRun

  2. After you click OK, the system will check whether your task is saved and submitted to the scheduling system. If the task is not saved or submitted, a dialog box appears to indicate you to save or submit the task.

  3. Click Confirm Submission, and select the business date in the Test Run dialog box.

    ConfirmSubmit

  4. Click Run, and the system tells you that the test run is successfully triggered, and you can go to the O&M center to view the progress.

    GoToCenter

  5. Click Go to the O&M Center to enter the O&M center page. Right-click the task name and select View Log.

    The log information is as follows:

    As you can see from the log, the system scheduling parameter has been replaced.

    Note:

    Why the selected business date is 20170806, but the replaced result is 20170807? That is because the conversion rule is: actual date = business date + 1.

Use cases

Connect to database by using SHELL

  • If the database is built on Alibaba Cloud and the area is East China 2, you can connect to the database by opening the database to the following whitelist.

    10.152.69.0/24,10.153.136.0/24,10.143.32.0/24,120.27.160.26,10.46.67.156,120.27.160.81,10.46.64.81,121.43.110.160,10.117.39.238,121.43.112.137,10.117.28.203,118.178.84.74,10.27.63.41,118.178.56.228,10.27.63.60,118.178.59.233,10.27.63.38,118.178.142.154,10.27.63.15,100.64.0.0/8

    Note:

    If the database is built on Alibaba Cloud but the area is not East China 2, you are recommended to use the extranet or purchase an ECS in the same area of the database as the scheduling resource to run the SHELL task on a custom resource group.

  • If the database is built locally, you are recommended to use the extranet connection and open the database to the preceding whitelist IP addresses.

    Note:

    If you are using a custom resource group to run the SHELL task, you must add the machine IP address of the custom resource group to the preceding whitelist.

Thank you! We've received your feedback.