sg-agent.zip is Microsoft Windows™ executable recommended for routine/automatic uploads. SG-Agent can be run as a program to streamline integration, an SFTP client, or both.
When run as a program to streamline integration, SG-Agent:
When used as an SFTP client, SG-Agent connects to a SameGoal SFTP server and uploads files using a directory structure recognized by SameGoal.
SG-Agent is configured using a single text file located at C:\sg-agent\config.txt. The format of config.txt is:
Arguments for each command:
odbc_connection_string - The connection string used to connect to your database server. This should should include information such as your database server username and password as well as the hostname of the database server. Please consult your database server documentation or connection strings examples for help in finding the correct database server connection string. This command may be specified zero or one times in the config.txt file. Example valid connection strings:
sftp_username - Your district domain, which is also your district's SFTP username on the upload host (upload.iepanywhere.com). This command must be specified exactly once.
sftp_host_public_key_md5 - md5 hash of SameGoal SFTP server's public key. This field is for security purposes and should never be changed. This command must be specified exactly once.
sftp_public_key_file - The relative path to your public key file. This value defaults to certs\id_rsa.pub. Using this command is only necessary when you have a non-standard named public key file, or if a single install of sg-agent is uploading files for several different districts (eg: at an ITC). This command is commonly used with the -config flag. This command can be specified zero or one times.
sftp_private_key_file - The relative path to your private key file. This value defaults to certs\id_rsa. Using this command is only necessary when you have a non-standard named private key file, or if a single install of sg-agent is uploading files for several different districts (eg: at an ITC). This command is commonly used with the -config flag. This command can be specified zero or one times.
tables - A space separated list of tables to upload. Information will be extracted from each table by running a query of the form: "SELECT * FROM
sql - Create a new CSV file and populate it with the result set from the specified SQL statement. This command can be specified zero more times (one time per SQL statement you wish to run). If this command is specified one or more times, the odbc_connection_string command is also required. NOTE: This command is rarely used (if possible, use "tables" instead).
files - Upload the specified file(s) for import by SameGoal. Use this option if you wish to create CSV file(s) with an external program/script but upload them using SG-Agent. This command can be specified zero or one times. For example:
Command Line Usage:
For most users, (those uploading data for a single district) sg-agent.exe can be run directly without any flags. Simply add a Windows™ Scheduled Task to run the sg-agent.exe program once per day. Advanced users: If you wish to check the return status of sg-agent or configure uploads for multiple districts, SG-Agent returns 0 in the event of success and a non-zero value in the event of failure. In Windows, to echo the return code of the preceding command, use ECHO.%ERRORLEVEL%. Example:
To check for a non-zero return code use IF %ERRORLEVEL% NEQ 0 .... Example:
SG-Agent uses Google-style command line flags to configure execution. To see a list of all supported flags, run sg-agent.exe with the -help flag. Example:
SG-Agent can be run with multiple different config files using the -config flag. Example: