Stopping/Starting services before/after fixlets

(imported topic written by taltrade91)

We want to create a custom action in which the following happens:

  1. Pre-Execution Action Script: A service gets stopped.

  2. Some fixlets get pushed.

  3. The machine gets rebooted.

  4. Post-Execution Action Script: The aforementioned service gets started.

The automatic-reboot is easy, and that’s working. However, I’m not getting my service to stop/start as planned. I currently just have the following simple BigFix Action Script: “dos net stop servicename” (without quotes, where servicename is modified to reflect one of our actual service names). The post-execution script is the same, except it uses start instead of stop. Any ideas on getting the service to stop/start.

(imported comment written by BenKus)

That should work… what is the service name (and are you sure you aren’t using the service display name?)

Ben

(imported comment written by jessewk)

Hi Taltrade,

I don’t think you need step 4 as long as the service start mode is set to automatic. All services set to automatic will launch on startup.

For step 1, I would start by finding with the query:

service names of services

Then use this action script to stop the service:

// set the service start mode to automatic
wait “{pathname of client folder of site “BESSupport” & “\changeservicestartmode”}” “” auto

// stop the service:
waithidden cmd /C net stop “”

Jesse

(imported comment written by taltrade91)

We don’t want the service to start automatically every time the computer starts, so the service start-mode is set to Manual. Granted, we DO want it to start automatically in this particular case, but not always.

I think my problem is w/ the actual service name, so I will try editing that.

Thanks all for your help!

(imported comment written by taltrade91)

(disregard)

(imported comment written by taltrade91)

Okay, the services stop and start as desired now. However, the reboot is happening at the wrong time. Here is what happens now:

  1. Service gets stopped (good)

  2. Patches get installed (good)

  3. Service gets started (BAD, TOO EARLY)

  4. Machine gets rebooted

The service start needs to happen AFTER the reboot.

Any thoughts?

(imported comment written by SystemAdmin)

Are you trying to stop and then start the action in the same action script?

You could always drop some sort of flag in the registry to indicate your process has run and when it ran. Set your service to automatic temporarily and then when the machine restarts, the service will start.

Then you have a monitor action clean up your flag in the registry and set the service back to manual. The relevance would be exists flag and and maybe uptime <= (now - flag time)

(imported comment written by BenKus)

You could also make multiple actions and put them in a baseline with the “start service” action coming after the “restart” action…

Ben

(imported comment written by taltrade91)

Ben, I’ve tried to add some Bigfix tasks into a baseline, but it’s still not working entirely. Here is what I’ve done now. In a baseline, I’ve added the following items, in this order:

  1. Stop Service*

2 thru 48. (several June fixlets)

  1. Restart Computers*

  2. Start Service*

  • These are Bigfix tasks, and these are their actual names.

When I run this baseline, everything works EXCEPT the “Restart Computers”. It never happens; the machines stay running, and they show as “Pending Restart”. However, the “Start Service” task works fine, so it’s as if it just skips right over the Restart step.

(imported comment written by taltrade91)

Now, I’ve got it working. Instead of using the “Restart Computers” task, I created my own task w/ that contained the code “restart 60”. That works. I found that on this thread…

http://forum.bigfix.com/viewtopic.php?id=3033

Did anyone have the file downloaded or script action available. The link doesn’t works!
Tks!

That’s a pretty old post … what is it you need to do ?