Fixlet to ditribute a file

(imported topic written by AndreiShoro)

hello.

I am
new in the branch and I have to create my first fixlet which sound like this:

I need a TEM fixlet to distribute the following file to server nodes into the directory

C:\Program Files\Tivoli\tsm\baclient\dsm.opt

During the distribution with TEM a target specific configuration is required for the file:

the token must be replaced with the hostname of the target.

For example for the host Computer1, token must be replaced with the value Cumputer1.

I need help creating this fixlet. from the begining :frowning:

I hope somebody will help me…

(imported comment written by Tim.Rice)

I’m going to tackle the concept a little differently that you seem to lay it out. Rather than download a file and then edit it, I’m going to recommend you build the file on the fly, and replace the HOSTNAME in the appropriate line(s) as the file is created.

The concept is fairly simple.

If you insist that this be a FIXLET, then we need to first determine a relevance clause that will differentiate between the file you WANT to deposit, and the one that is ALREADY there. For a Fixlet to return a Status of Fixed, the relevance clause must evaluate to TRUE before the Fixlet runs, and FALSE after it runs. That’s a bit more than I want to tackle here.

To keep this simple, I recommend using a TASK to perform what you want to do.

To take your request, literally …

  1. In the Console, select the ALL CONTENT domain (lower left corner of the Console).
  2. From the Tools menu choose CREATE NEW TASK …
  3. Give your new Task a descriptive name and briefly describe what it is going to do.
  4. Click on the RELEVANCE tab
  5. We’re going to limit this task to only running on Windows machines that seem to have TSM installed (based on the folder being there).
  6. Choose the third radio button, and we’ll enter some Relevance clauses to limit the targeting for the Task.
  7. Enter ((Name of Operating System as lowercase) starts with “win”)
  8. Click the [+] to the right of the clause to add a second relevance clause to the Task. These clauses will be joined together with AND when evaluated by the clients.
  9. Enter (Exists folder “C:\Program Files\Tivoli\tsm\baclient”)
  10. This clause will ensure that the destination folder exists and that TSM looks like it’s installed. To really tell if TSM is really installed would take a more complicated clause, and I’m at home with no access to test a clause like that right now.
  11. Now click on the ACTIONS tab and we’ll start on the meat of the Task.
  12. Enter the following text into the Action (flushing out your dms.opt file contents between the createfile and ##END## lines)

// We’re going to use the Parameter command to simplify this a little.

parameter “Host” = “{Computer Name}”

//We are going to build the new file “on the fly” and insert the Parameter we created above.

//Be sure that there is not already a __createfile file or we could get an error, and the Task would abort.

delete __createfile

//“createfile until” will do exactly what it says. It will add each line to __createfile until we get to the specified line.

//Anywhere you want to insert the name of the computer, use the text {Parameter “Host”}

//The curly brackets tell the Agent, to treat the text between them as “Relevance” and replace the text with the results.

//In this case, the Parameter command at the top of the action will set the “Host” Parameter equal to the name of the computer running the action.

//You could simply use {Computer Name}

//If the File you are trying to build contains a left hand curly bracket, you will need to “Escape” it by doubling it. You don’t need

//to double the right hand or closing curly brackets.

createfile until ##END##


  • Tivoli Storage Manager (TSM)

  • dsm.opt for the Microsoft Windows Backup-Archive Client

ssw**************************************************************

Exclude “*:\macintosh volume*”

Exclude “*:\macintosh volume…*”

Exclude “*:\microsoft uam volume…*”

… (put the contents of your dms.opt file here placing {Parameter “Host”} anywhere you want the computer name to be inserted.


nodename {Parameter “Host”}

##END##

//Now we have the file created and need to move it into place

//First we delete the original if it exists

if {exists file “C:\Program Files\Tivoli\tsm\baclient\dsm.opt”}

delete “C:\Program Files\Tivoli\tsm\baclient\dsm.opt”

endif

move __createfile “C:\Program Files\Tivoli\tsm\baclient\dsm.opt”

OK, that should do it. BEFORE you save your new Task, look in the upper right corner of the dialog box. Be sure that you are saving the Task in the Site you intend. By default, unless you are a Master Operator, it will save it in your Personal Site. This means that nobody else, other than a Master Operator will be able to see the new Task. If you need to change it, do so now then click the OK button and save your new Task.

Give it a few minutes and Windows machines with TSM installed should start to report as Relevant to the Task.

Targeting any of these machines with the Task will create your new file with the Target computers name inserted where ever you put the {Parameter “Host”} string.

NOTE: To cover my posterior and yours, I STRONGLY suggest you create the TSM folder path on your workstation, let your machine report to the task, and test the Task against YOUR computer rather than a production system to ensure that I got this right, and that everything works properly.

With a little more work, it would be possible to modify the Task so that no matter where TSM was installed, the dsm.opt file could be built correctly, including all the path names for logs, etc. This task will only update TSM installed in the default location. Hint: It might involve creating a “Path” parameter that looked for the Install Path in the registry.

If testing reveals any problems with the task, or you have other questions, I’ll be happy to help, within reason :slight_smile:

(imported comment written by AndreiShoro)

Hello Tim,

I want to thank you for your time and the quick answer.

The task is working like a charm :slight_smile:

Thank you again and have a nice day!