Utilize the following scripts to send your first file(s) and lower the barrier to automation in the future.
Sample Scripts / Transfer Commands:
Windows Transfer Script
The script below is a Windows™ batch script which will change to the proper directory and call PuTTY’s PSCP command to copy all CSV files in the directory to the remote server. Simply copy and paste the text below into a file called pharos360_data_transfer.bat and replace the portions in capital letters with the proper directory names and username supplied to you by Pharos Resources. Lines beginning with rem are comments and will be ignored. Since the script is usually run by the system at a specific time every day, the -batch flag tells it not to prompt for input; this will ensure that the script will simply exit if there are any errors when executing (you should remove this option the first few times you attempt to transfer the files, otherwise you will not see any errors). Finally, the -i flag tells the script to look for the private key at the specified location.
Please note that the first time you connect, you will be prompted to cache our server's fingerprint on your machine. The -batch flag will prevent you from seeing this prompt
rem This line, and other lines with 'rem' in front, are comments
rem This program copies the necessary files to the Pharos 360 application rem rem The pscp command to transfer files has the following format: rem rem pscp -batch -i key_file local_files_to_copy.csv username@server.com:directory_to_store_files
rem
rem The first time you run this script, you need to accept the fingerprint of our server. Use the following format to do this:
rem echo y | pscp -i key_file local_files_to_copy.csv username@server.com:directory_to_store_files
rem
rem Important! Leaving the script running constantly with 'echo y' and no '-batch' flag leaves you open to DNS poisoning and transferring files to a malicious actor's servers.
cd C:\MY\PHAROS360\DATAFILES\DIRECTORY pscp -batch -P 22 -i C:\PATH\TO\MY\PRIVATE_KEY.ppk *.csv UNIV_CODE@UNIV_CODE-uploads.pharos360.com:uploads/
If running the pscp command from a service account, you may be unable to accept and cache the host key. In this case, you can manually specify the expected host key by including the -hostkey switch, followed by the fingerprint of the target server, like the example below. The fingerprint will appear in the warning during your first connection attempt and can be verified by support. This value will appear as a SHA-256 (SHA256:AbcdEFGhIJklMnOpQrStuVWXyz0123456789+abCDef) or MD5 (01:23:45:67:89:ab:cd:ef:01:23:45:67:89:10:ab:cd) fingerprint.
pscp -batch -P 22 -i C:\PATH\TO\MY\PRIVATE_KEY.ppk -hostkey ADDSERVERFINGERPRINTHERE *.csv UNIV_CODE@UNIV_CODE-uploads.pharos360.com:uploads/
Linux Transfer Command
- Log in to the machine as the user that will be sending the files
- Use the
cdcommand to change to the directory containing the data files to be uploaded - Use the following command to copy the files to our server:
scp -i /path/to/your/private/key/.ssh/id_rsa *.csv UNIV_CODE@UNIV_CODE-uploads.pharos360.com:uploads
What's Next
Once the initial connection is confirmed and foundational files are approved, we will ask you to automate the file transfer on a nightly basis. Either a cron job or Windows scheduler should be used to automate data transfer on a nightly basis.
By scheduling this job, you will ensure your campus has the most up-to-date information throughout the semester.
Please make sure the job is set to complete before 5 a.m. ET/4 a.m. CT to ensure the latest files are imported daily.
Comments
0 comments
Please sign in to leave a comment.