The main issue for authoring tools for UNIX/Linux is pathnames. Windows uses the drive letter convention ("D:\") for local disks and the UNC convention for resources on the LAN ("\\<host>\<directory>"). UNIX/Linux uses the forward slash convention of /<host>/<directory> for pathnames. When you are authoring and testing your tools, you do so on Windows, so all your pathnames are using Windows convention. Before moving your tools to UNIX/Linux, you need to decide on a method that allows Windows pathnames to be converted to UNIX/Linux pathnames. There are several ways to do this:
- Rely on relative pathnames to data (no conversion of pathnames needed).
- Use ArcMap layers and convert their pathnames before copying to UNIX/Linux.
- Let ArcGIS Server convert Windows UNC pathnames to UNIX/Linux pathnames.
- Use a combination of the above techniques.
These techniques are discussed below.
Rely on relative pathnames to data
By far, the easiest approach is to use the
toolshare folder structure to store all data used by your tools. You set the properties of your map documents, model tools, and script tools to
store relative pathnames. You then copy the toolshare folder to the UNIX/Linux platform and publish the service using
ArcGIS Server Manager. When tasks in the service execute, they can find all their data relative to the toolshare folder.
Use ArcMap layers
With this technique, you publish an ArcMap document containing tool layers. Your model and script tools use layers and tables in the ArcMap table of contents. You then do the following before copying your map document and toolboxes to UNIX/Linux:
- Open your ArcMap document and set the Data Source option to Store full path names to data sources, as follows:
- In ArcMap, click File menu > Document Properties.
- In the properties dialog box, click Data Source Options.
- In the Data Source Options dialog box, click Store full path names to data sources.
- After saving your settings, save the map document and exit.
- In ArcCatalog, right-click your ArcMap document and click Set Data Source(s).
- In the Set Data Source(s) dialog box, provide the UNIX/Linux pathname to all layers including sublayers of tool layers. (Changing sublayers of tool layers is necessary only if you are using a result map service.)
- After setting pathnames, close the dialog and copy the ArcMap document and toolboxes to the UNIX/Linux machine.
- Publish the service by publishing the ArcMap document, not the toolbox.
Let ArcGIS Server convert Windows UNC pathnames
When a geoprocessing service is executing on UNIX/Linux, all Windows UNC pathnames ("\\xyzzy\") are converted to UNIX/Linux convention ("/xyzzy/"). Local Windows pathnames ("D:\") cannot and will not be converted.
This means you can mount the UNIX/Linux disk ("/xyzzy/") on your Windows machine and refer to data on the mounted disk using the Windows UNC path ("\\xyzzy\"). You then copy your documents and toolboxes to the UNIX/Linux machine and publish using ArcGIS Server Manager.
Use a combination of the three techniques
You can use a combination of these techniques. For example, some of your data could be stored relative to your toolbox, and your tools can use relative pathnames. For the subset of data not stored relative to your toolbox, you can use layers in the ArcMap document that references the data and then convert the pathname before copying.
Although the main consideration is converting pathnames, there are two additional issues specific to services running on UNIX/Linux: the 100-character limit and lowercase dataset names. Both are described below.
The 100-character limit for GRID and coverage pathnames
There are two data formats that have restrictions on the number of characters in their pathname:
- GRIDs (ESRI's native raster format)
- Coverages (ArcInfo Workstation features)
The total length of the pathname to the workspace where the GRID or coverage is written cannot exceed 100 characters. Since intermediate and output data is written to the scratch workspace, the total number of characters in the scratch workspace cannot exceed 100.
Here is an example of the contents of %scratchworkspace%:
/disk/arcgisserver/arcgisjobs/drivetimepolygonsservice_gpserver/
jc01a0ddb3dc94455b8eb6629cf421798/scratch/
Portion of pathname |
Number of characters |
Description |
/disk/arcgisserver/arcgisjobs/
|
30 |
Jobs directory. Since either you or your system administrator sets up the jobs directory, the number of characters is under your control. |
drivetimepolygonsservice_gpserver/
|
34 |
Service name. (_gpserver is automatically appended by ArcGIS Server.) Since you name the service, the number of characters is under your control. |
<folder name> |
|
When publishing a services, you can designate a folder name. The name of this folder would appear here. The number of characters in the name of the folder is under your control. |
jc01a0ddb3dc94455b8eb6629cf421798/scratch/
|
42 |
Unique job ID plus the scratch folder. This is defined by ArcGIS Server and is not under your control. |
TOTAL |
106 |
|
In the above table, the pathname to the scratch workspace is 106 characters, which exceeds the 100-character limit. You would need to reduce this by six characters. In the above example, the easiest method for reduction is to rename the service from drivetimepolygonsservice to something shorter, like dtpolys.
Learn more about the jobs directory.
Lowercase dataset names
GRIDs and coverages must have lowercase names on UNIX/Linux. Although these are the only two datasets that require lowercase names, you should establish the practice of using lowercase names for all datasets, including directory names.