Search

GlobalSCAPE Knowledge Base

Can I copy my EFT Server log files to another location using FTP commands or Event Rules?

Karla Marsh
EFT Express (SMB) & Enterprise

THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT Server (All Versions)

QUESTION

Can I copy my EFT Server log files to another location using FTP commands or Event Rules?

ANSWER

Yes:

  • You can create a custom Command in EFT Server using Window's xcopy command, then create a Timer Event Rule
  • Copy the file manually from your FTP Client, such as CuteFTP Professional

The following example describes the configuration of a custom command from the perspective of both the EFT Server and client. To follow the example exactly, you will need to download and install CuteFTP Professional, which is available as a free 30-day trial and can be downloaded from http://www.globalscape.com/downloads/. However, any client that supports custom commands or raw FTP commands will work.

This Command copies the EFT Server log files from the EFT\Logs folder to C:\Temp using the Windows xcopy command.

Creating a custom command

  1. In EFT Administrator, connect to EFT Server and click the Server tab.
  2. In the left pane, expand the Site node for the Site that you want to configure, then click Commands.
  3. In the right pane, click New. A new set of tabs appear at the top of the pane named Command, Advanced, and Permissions.
  4. On the Command tab, select the Enable this command check box.
  5. In the Command Name box, type xcopy.
  6. In the Description box, type Copy folder contents.
  7. In the Executable box, type or browse for the path to the Windows xcopy command. By default, the path is C:\Windows\system32\xcopy.exe.
  8. In the Output area:
    • Select the Redirect output to client check box, if you want the client to display the results of the command.
    • Select the Redirect output to system log check box if you want to send the results of the command to the system log, EFT\cmdout.log.
  9. Click the Advanced tab.
  10. In the Pass the following to the command box, you would provide the parameters required to execute the command. For this example, leave the box blank; you will provide the parameters when you run the Command in the client or the Event Rule. (By leaving the command box blank, you can reuse this command for other copy tasks.)
  11. The xcopy command can take multiple parameters, but you need at minimum the source and destination path. Select the Require parameters check box, then in the Command must have at least __ parameters box, type or select 2.
  12. In the Invalid parameter count message field, type the message that you want the connected client to receive if the incorrect number of parameters is provided. You could also describe what the proper syntax is so that the user knows what to provide. For this example, type:

    Invalid number of parameters. Correct syntax is: site xcopy "source" "destination" /d.

    (The /d parameter copies all new files in the specified folder.)

  13. Select the Enable process timeout check box, and provide the number of seconds to wait for a failed process. For this example, in the Terminate Process if still running in __ seconds box, type or select 60.
  14. Click the Permissions tab.
  15. In the Site users/groups box, double-click the users and/or groups who have permission to execute the command to move them to the Permit execution box.
  16. Click Apply to save the command on EFT Server.

FTP Client Configuration

You can run the Command "on the fly," configure the Command in the FTP client, or insert the Command in an Event Rule.

Using the Command "on the fly" in CuteFTP Pro

  1. Start CuteFTP Pro and connect to EFT Server.
  2. If not already displayed, open the Session Log pane. (On the main menu, click View, point to Show Panes, then click Individual Session Logs, or press ALT+2.)

  3. Right-click a blank area of the Session Log, then click Input Raw FTP Command, or press CTRL+SHIFT+I. The Input FTP Command dialog box appears.
  4. In the Command box, type site, the name of the Command as defined in EFT Server, and any required parameters. For this example, type:


  5. site xcopy "C:\Program Files\GlobalSCAPE\EFT\Logs" "C:\Temp" /d
  6. Click OK. The Command executes. In this example, each of the files in the \EFT\Logs folder that is newer than the same-named file in the \Temp folder was copied to the \Temp folder. If you selected the Return output to client check box when you defined the Command in EFT Server (step 8 above), the Session Log displays the results of the Command. For example:

COMMAND:> site xcopy "C:\Program Files\GlobalSCAPE\EFT\Logs" "C:\Temp" /d

220-C:\Program Files\GlobalSCAPE\EFT\Logs\ex080207.log

220-1 File(s) copied

220-220-

220 Command completed with code 0.

Configuring the Command in CuteFTP Pro

  1. Start CuteFTP Professional and connect to EFT Server. (See the CuteFTP Pro help for details of how to connect to a site.)
  2. On the main menu, click Tools, point to Custom Commands, then click Edit Custom Commands. The Custom Commands dialog box appears.

Note: You must be connected to an FTP server in order for the Commands option to be available.

  1. Click New, then type a name for the command. For this example, type xcopy.
  2. Click the command in the tree, then click Edit or right-click the new command and click Properties. The Custom Command Properties dialog box appears.
  3. In the Label box, the name of the command appears.

  4. In the Command box, type:
  5. site xcopy "C:\Program Files\GlobalSCAPE\EFT\Logs" "C:\Temp" /d

Note: Commands must start with site and then the command name you used in EFT Server, not the name you gave the command in CuteFTP. The /d parameter copies all new files in the specified folder.

  1. Optionally, specify any key or key combination for the Shortcut Key and any icon for the Toolbar Icon.
  2. Select the Place on the Custom Commands toolbar check box, then click OK to close the Custom Commands Properties dialog box.
  3. Click OK to close the Commands dialog box. Your custom command is now enabled and the icon, if specified, appears on the toolbar. (If the command is not displayed, click View, point to Toolbars, then click Custom Commands Bar.)
  4. Start CuteFTP Pro and connect to EFT Server.
  5. If it not already displayed, open the Session Log pane. (On the main menu, click View, point to Show Panes, then click Individual Session Logs, or press ALT+2.)
  6. On the toolbar, click the Command icon that you just created.
  7. Monitor the output in the Session Log. You should receive various response messages indicating the progress of the archive.

Executing the Command Automatically Using an Event Rule

If you want to copy the log file automatically every day, you can create a Scheduler (Timer) Event and insert the Execute command in folder Action. Using this method, you would have to define the parameters in the Custom Command dialog box from within the Event Rule. (Refer to "Scheduler (Timer) Event" in the help documentation for a detailed procedure.)

Possible Error Situations

  • If you repeat the hard coded parameters in both the client and EFT Server, then the first parameter that the client sends will be used. For example, if SITE ZIP -c %at[archive name] %ff is configured in the client, and -c %1% %2% is configured in the Server, then the first parameter (-c) that the client sends will be used as %1% and the resulting string would be -c -c filename.ext. Therefore it is important to educate users on the proper syntax and supply most of the hard coded parameters on the Server side.

  • If you do not give the user permission to run the Command on the Permissions tab on EFT Server, they will receive a "Permission Denied" error.

  • Certain command line utilities that may show a Windows prompt or other dialog may not execute properly when called from the FTP Engine while it is running as a service. This is especially true when the service is being logged in from a Local System account.

  • EFT Server returns an error if the client provides the wrong number of parameters or invalid parameters.

  • In order to limit security vulnerabilities to EFT Server, the server administrator should only allow limited access to commands that launch processes.

Security Note: Always use caution when giving program access to your system32 directory (especially an FTP server).

Details
Last Modified: 8 Years Ago
Last Modified By: GlobalSCAPE 5
Type: HOWTO
Article not rated yet.
Article has been viewed 13K times.
Options
Also In This Category
Tags