The SAS 9.2 Hot Fix Analysis, Download and Deployment tool available at http://ftp.sas.com/techsup/download/hotfix/HF2/SAS92HFADD.html is a fantastic step forward by SAS in helping SAS Administrators keep their system up to date. Paul Homes from Metacoda has previously blogged about this tool and how (much fun it is) to get it working under Windows 2008 R2 with UAC enabled - http://platformadmin.com/blogs/paul/2011/01/sas92hfadd-viewregistry-windows-server-2008-r2/
I have used this tool on quite a few sites (on Windows, Unix and Linux) and once it is working it is great! Unfortunately I estimate it has only worked “out of the box” for 1 in 10 installs, and the reason is usually a firewall. This blog post describes my workarounds to this situation…
The ProblemThe SAS92HFADD tool uses the File Transfer Protocol (FTP) to download various files from the SAS FTP site. If the machine running this tool is behind a firewall (which should be the standard situation in a corporate environment) then "normal" FTP may not work. One method implemented within the file transfer protocol to allow communication through some firewall implementations is "passive" mode. There are some tweaks we can make to the files provided by SAS as part of this package to get it to use passive mode, but unfortunately the FTP client provided with the Windows operating system does not support passive mode (see http://support.microsoft.com/kb/271078). The Unix/Linux FTP clients I’ve seen will support passive mode without any problems.
Unix/LinuxDownloading the Unix version of the tool and untarring it will result in two files:
SAS92_hot_fix_data_ftp_download.shThe 5th line of this file reads:
ftp -n $HOST <<-EOF
Add in the “-p” switch and save the file:
ftp -p -n $HOST <<-EOF
SAS92HFADD.plThe 646th line of this file reads:
$ftpscript .= "ftp -n \$HOST <<-EOF\n";
Change this to:
$ftpscript .= "ftp -p -n \$HOST <<-EOF\n";
Under Unix/Linux these are all the changes that are required. Following the provided instructions from SAS should now work.
WindowsThe Windows version of the tool requires a bit more work since the Perl code that we could have edited (as above with the Unix version) is packaged into an executable file along with a Perl runtime. The download is a self extracting archive which when run will provide three files:
Once you have downloaded MOVEit Freely copy the "ftps.exe" file into the SAS92HFADD directory created by the tool and rename it to "ftp.exe".
The fourth line of this file has the "binary" command and line five has the "get" command. Insert a line after line four with the "passive" command. I also like to see that something is actually happening, so I also insert the "hash" command which prints a hash mark (#) after a certain amount of bytes have been downloaded giving you a kind of progress status.
Step 1 - Edit SAS92_hot_fix_data_ftp_download_script.txt
Here is my edited file:
get [long path removed to fit in blog post]
Step 2 - Run the SAS92HFADD.exe fileRunning this file will call the batch file, which includes the script we just edited, which then downloads an XML file from SAS of all the latest hot fixes. It then parses this file and compares if to the DeploymentRegistry.txt file you created (as part of the standard steps of this tool) and then generates the Analysis Report, Download scripts and Deployment scripts.
The tool dynamically creates a DownloadTools subdirectory under a time stamped parent directory within the SAS92HFADD directory. Depending on whether you want all hot fixes or just Alert hot fixes you then need to edit the appropriate batch and script files. I will edit the "all hot fixes" files, but the changes are the same for the Alert only files.
Step 3 - Modify the generated download batch and script files
ftp_script.batThis file needs to use the MOVEit freely FTP client, so you can either copy our new "ftp.exe" into this directory or edit the batch file to use the one we already have in the SAS92HFADD directory. I edited the batch file to use my existing copy (i.e. prefix the ftp command with "..\..\"):
ftp_script.txtLike the previous text file edit, we need to insert the "passive" command and the "hash" command if you like to see the progress:
Here is the top of my ftp_Script.txt file after the edits:
get [long path removed to fit in blog post]