Personnalisation avancée > Business Logic Customization > Packages Customization > Windchill Replication Package Command Line Sample Scripts
  
Windchill Replication Package Command Line Sample Scripts
You can automate the process of uploading and importing the received deliveries. This section shows some example scripts and includes information on how this can be achieved using a job or task scheduler.
* 
For more information on the utility, see Windchill Package Command Line Utility
Windows
In following sample, the upload_import_rd.cmd script is run every 8 hours.
schtasks /create /tn "Context Replication cron job" /tr
"C:\import_scripts\upload_import_rd.cmd /sc hourly 8
This is a sample upload_import_rd.cmd script to upload and import all uploaded received deliveries in a single job.

@echo off

GOTO EXECUTE

:EXECUTE

cd C:\ptc\Windchill\bin
windchill.exe com.ptc.windchill.rd.cli.WindchillPackage import -u demo
-c "/wt.inf.container.OrgContainer=Demo Organization/wt.pdmlink.PDMLinkProduct=NI_import"
-l "C:\Packages" -r -d

IF %ERRORLEVEL% == 1 GOTO IMPORT_FAILURE

GOTO END

:IMPORT_FAILURE
ECHO [Error] Import command has failed. Please see logs for details

:END

UNIX
In following sample, the upload_import.sh shell script is run every 8 hours.
* 8 * * * /bin/sh /path/to/script/upload_import.sh
In the following sample, the shell script runs the upload and import commands in sequence and the input of the upload is redirected in a file. This file is then given as input to an import command, so that import is started for only those received deliveries which are uploaded in the same script.
#!/bin/sh
java com.ptc.windchill.rd.cli.WindchillPackage import -u wcadmin -l
“D:\packages” -c “/wt.inf.container.OrgContainer=Demo Organization/wt.pdmlink.
PDMLinkProduct=Drive System” -d -m
IF [$?= 1]then exit 1
fi
exit 0