Pre-action/post action script samples

I want to create some simple pre and post-action scripts to stop and start services prior to patching. I know this has been done by many people and would prefer not to reinvent the wheel. My searches point to articles that no longer exist. I am begging for someone to provide examples of working scripts.

My assumption:

  1. Add scripts to the PRE-ACTION tab to stop service(s) and set to manual.
  2. Then, let the patching occur with a reboot.
  3. Use the POST-ACTION tab to start service(s) and set to auto.

Is this the correct process?

If you have done this successfully, can you please provide the example so I have someplace to start? Also, how do I know I’ve left enough time for a service to stop before patching?

@olsonc58 You can use any BigFix Action Script in the pre/post script Take Action Dialog (TAD) boxes when executing your baseline. Here is a big, messy screenshot to get you started.

Console is in the far background, showing the Action that was created.

Red boxes are the Pre-action part of the TAD, the resulting action in the console, and the resulting output on the target computer

Blue for the Post-action.

For more info on creating these custom action scripts, please see our developer site here:
https://developer.bigfix.com/action-script/guide/

1 Like

I also notice you mentioned stopping and starting a service.

you might use the action script lines in the Pre action to Stop the messenger service and the service2 service.

dos net stop messenger
dos net stop service2

And your post action might be

dos net start service2
dos net start messenger
1 Like

Thank you. This is enough to get me started. Some services may take up to 30 seconds or so to stop. However, I would assume it will take awhile for patching to complete anyway. Is the sequence of events as such?

  1. pre-action script
  2. patching
  3. reboot
  4. post action script

If you want to further delineate the pre and post action steps, you might want to look at the Server Automation tab. We have SA jobs that will stop service and send validation back to BF, then patch, reboot, restart service. All with check-ins to root with fail steps in case a step. does not process.
Another benefit is you can modify each step in the action without changing the other steps, and reuse steps in other actions if they are saved as individual fixlets. I have email notifications for specific steps that I use across multiple SA actions.

2 Likes

Wow, that sounds exactly like what I am looking for. Now, to show my ignorance…where is the Server automation tab? Is this a feature of the WebUI (which I have yet to install and configure)?

Should be a tab in console. Not sure if it has to be installed as it was already part of my environment when I inherited BF.
Not sure how many of these links are still valid: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli+Endpoint+Manager/page/Server+Automation

Server Automation is a feature of BigFix Lifecycle. You can tell if you are licensed for it in the License Overview Dashboard. You will see a panel like this:

image