Lesson 20: Upload files using SIRT

In this lesson, you upload files from the remote device using a server-initiated remote task (SIRT). This is a useful troubleshooting technique because an administrator can examine the files for problems.

When you started the MobiLink Agent on the remote device, you directed it to log messages to the file agent.txt. You are now going to retrieve and examine that file from the remote device.

 To upload files
  1. In the Folders view of Sybase Central under Central Admin Tutorial, right-click Remote Tasks and choose New » Remote Task. The Create Remote Task Wizard appears.

  2. On the Welcome page, type Upload Agent Log in the Name field.

  3. Uncheck This Task Requires or Creates a Remote Database if it is selected and click Next.

  4. On the Trigger Mechanisms page, click Next. This task is going to be defined as a server-initiated remote task and will be triggered by the administrator in Sybase Central. Click Finish.

  5. Click the new task in the Folders view and add a command to the task. Set the Command Type to Upload File.

  6. Set the Server File Name to {agent_id}\agent.txt and the Remote File Name to {agent_log}. You can use the ellipsis (three dots) button in the command editor to easily enter the macro values.

    The {agent_log} macro is replaced by the name of the log file being kept by the MobiLink Agent on the remote device.

    Notice that in the Server File Name field you specified the directory where the file will be placed using the {agent_id} macro. This is very important. If you do not use a macro when specifying the server file name then every Agent that executes the task will place their upload file in the same place, and each new Agent will overwrite the file written by the previous agent. By using a macro, we ensure that each agent will upload its log file to a different location on the server, allowing us to view all the log files.

  7. Right-click the new Upload Agent Log task and choose Deploy. Click Next.

  8. For Recipients, choose Specific Agents and then select agent AID_JOHN. Click Next.

  9. On the Delivery Options page, choose The Next Time the Agent Synchronizes and click Next.

  10. On the Reporting Results and Status page, set both If Task Succeeds and If Task Fails to Send Results and Status Immediately. Click Finish.

  11. The task needs to be Initiated by the administrator in Sybase Central. To Initiate the task, go to AID_JOHN under the Agents. In the pane on the right, select the Task tab. In the Task tab, right-click on the Upload Agent Log task and choose Initiate. Wait for the task to execute.

    The uploaded file is placed in the MobiLink upload directory that was specified it with the -ftru option on the MobiLink command line. You specified c:\cadmin_demo\consolidated\upload for the upload directory. Take a look at that directory using a command prompt or the Windows Explorer. You should find the AID_JOHN subdirectory. In that subdirectory is the agent.txt file that you uploaded. To upload the Agent log again, repeat step 11.