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.
On the Data Development page, click New and select Create Task.
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.
Click Create after completing the configurations.
If you want to call the System Scheduling Parameters in SHELL, do as follows.
The SHELL statement is as follows.
echo "$1 $2 $3"
Parameter 1 Parameter 2… Multiple parameters are separated by spaces. For more information on the usage of system scheduling parameters, see System scheduling parameters.
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.
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.
After you click Run on the page, a dialog box appears.
Click Set Up to redirect to the configuration page, and then click Add.
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.
Switch back to the Data Development page, and click Run to view the results.
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.
After you click Test Run on the page, a dialog box appears.
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.
Click Confirm Submission, and select the business date in the Test Run dialog box.
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.
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.
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.
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.
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.
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.