Running Agents from the Command-Line

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Running Agents from the Command-Line

You can run agents from the command line using the RunAgent.exe program, which you can find in the Content Grabber installation folder.

 

RunAgent.exe agentName

 

You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the program. If the agent is not located in that folder, Content Grabber will look in the default public agent location. The default public agent location is:

 

C:\Users\Public\Documents\Content Grabber 2\Agents

 

If your agent is not located in any of the default agent locations, you need to specify the full path to the agent file:

 

RunAgent.exe "C:\My Custom Folder\agentName.scg"

 

When running multiple agents in a batch file, you can use the Start command to run the agents asynchronously:

 

Start "WindowTitle" RunAgent.exe agentName1

Start "WindowTitle" RunAgent.exe agentName2

 

Exit Codes

The RunAgent.exe command line program returns one of the following exit codes:

Exit Code

Status

Description

0

Success

Data extraction was completed successfully.

1

Failed

A critical application error occurred during data extraction.

2

Incomplete

Data extraction was interrupted.

3

Completed with errors

Data extraction was completed, but with one or more page load errors or missing required elements.

4

Incomplete with errors

Data extraction was interrupted, and encountered one or more page load errors or missing required elements.

5

Export Failed

Data extraction failed because it was unable to export data. You can manually open Content Grabber and attempt to export.

6

License Restriction

The agent contains features that are only available to agents created with a Premium Edition of Content Grabber when using the royalty free runtime.

7

Completed Unsuccessfully

Agent run completed without meeting defined success criteria.

8

Already Running

Trying to start an agent that is already running.

9

Invalid Data Cannot Continue

Retrying or continuing an agent that has an invalid internal data structure.

10

Initialization Script Failed

The agent initialization script failed.

11

Process Start Timeout

Timeout waiting for agent process to start.

12

Unknown Exception Check Log

Unknown error. Look for details in the error log.

13

Invalid Parameter

An invalid agent command-line parameter was specified. Look for details in the error log.

14

Process Error Exit Before Start

The agent process exited with an error before the agent started successfully.

15

Agent Import Folder not Found

An agent import folder has been specified, but the folder does not exist.

16

Agent Import Name Empty

An agent import name has been specified, but the name is empty.

17

Error Creating Default Document Folders

An error occurred while trying to create default Content Grabber folders in the current users document folder. This error will only be returned from the Content Grabber editor, never from the Content Grabber runtime.

18

Default Log Folder Missing

The log_to_file or log_path has been specified without a log path.

19

ErrorCreatingDefaultLogPath

Error creation specified log path.

 

Command Line Arguments

Input parameters can be added as command line arguments. The input parameter name must be preceded with a dash. For example:

 

RunAgent.exe agentName -username "test" -password "test"

 

Please see the topic Input Parameters for more information.

 

The following command line switches can be used, and should not have a preceding dash:

Switch

Description

log_level

Log detail level. Logging is turned off by default.

 

Example: RunAgent.exe agentName log_level High

log_html

Logs the HTML of all loaded web pages to files.

 

Example: RunAgent.exe agentName log_html

log_to_file

Logs information to a file instead of a database. A log path must be specified. Specify an empty string to use the default log path.

 

Example: RunAgent.exe agentName log_to_file ""

view_browser

Displays the web browsers used to navigate the target website.

 

Example: RunAgent.exe agentName view_browser

no_ui

No user interface will be displayed. This will cause an agent pause command to fail.

 

Example: RunAgent.exe agentName no_ui

session_id

The agent will run in a specified session.

 

Example: RunAgent.exe agentName session_id sdgfdf4353

session_timeout

If an agent runs in a session, this is the session timeout in minutes. The default session timeout is 30 minutes.

 

Example: RunAgent.exe agentName session_id sdgfdf4353 session_timeout 10

run_method

Specifies how to run an agent. One of the following values is expected.

 

Restart

Continue

ContinueRefreshAgent

ContinueAndRetryErrors

ContinueAndRetryErrorsRefreshAgent

 

Example: RunAgent.exe agentName run_method continue

agent_import_folder

If the specified agent is an exported agent, the agent will be imported to this folder.

agent_import_name

If the specified agent is an exported agent, the agent will be renamed to this name. Only applicable when agent_import_folder is specified.

log_path

Use this parameter instead of log_to_file if you want to log to database, but want to specify the log path for any errors that occur before the agent is able to log to database. Don't specify this parameter if you have already specified log_to_file.