Combine a Linux command and Windows command to create a fixlet

I am trying to create a fixlet to automate a manual process. There is a Linux server which I need to run "/opt/eagle/PACEv2015/eaglemgr/stop ALL " as an application service account called eagleservice. Then I need to stop the following Windows services on two different Windows servers:
Eagle EMShell Service 2
Eagle P A C E 32
Eagle Report Service 1

After all these are stopped I need to restart them by running the start ALL on the LInux server, “/opt/eagle/PACEv2015/eaglemgr/start ALL” in production this needs to happen on other Linux servers. There are a total of 5 Linux servers in a cluster running this application. Then restart the Windows app services.
Eagle EMShell Service 2
Eagle P A C E 32
Eagle Report Service 1

Is it possible to do all this with BigFix and a single fixlet? This would be ran daily around 1am EST. I am new to BigFix but see it can accomplish amazing things but not certain how to create a fixlet to do this on multiple servers in a sequence of events.

Any assistance or pointing me in the right direction is greatly appreciated.

Sure, there are a number of fixlets that do similar things (such as the “Upgrade Bigfix Server” fixlets in the BES Support site). Running from memory her but you can do things like

if {windows of operating system}
...do windows things
endif

if {name of operating system as lowercase contains "linux"}
...do linux things
endif
2 Likes

Be easy on me I am very noob to BigFix content authoring. :slight_smile:

I am trying to figure out if I should place these as two different fixlets and place them in a baseline or just make one fixlet and only apply it to the specific servers. To do that would I just make the Relevance as hostname=servera, serverb, etc.

Then for the Linux servers it would run the PACE one liner to stop the services and then on the Windows server it would stop those 3 services.

if {name of operating system as lowercase contains “linux”}
delete “{(client folder of current site as string) & “/__appendfile”}”
appendfile #!/bin/sh
appendfile /opt/eagle/PACEv2015/eaglemgr/stop ALL & pid=$!
wait chmod 755 “{(client folder of current site as string) & “/__appendfile”}”
wait sh “{(client folder of current site as string) & “/__appendfile”}”

if {windows of operating system}
waithidden net stop "emshell2"
waithidden net stop "Eagle P A C E"
waithidden net stop “ReportExportService 1”

There probably is an easier or cleaner method to write this but not 100% certain about that. I would then just create another fixlet that would start everything back up, replacing the stop with start.

Any issues with my thinking or is that how this should work?

“unix of operating system” would also work; the obvious challenge being that you might need different commands depending on the particular flavour of 'nix.

Also worth keeping in mind is that MacOS is technically True gor that particular piece of relevance.

That is why I was trying to figure out how I can call out specific host names. This will only be ran on 8 Linux servers, the Linux portion, and 4 Windows servers, the Windows portion.

I want to apply this to the 12 servers with the Linux servers doing the stopping of that service and the Windows servers stopping their services. Then I will create a new one except it will start all the services accordingly.

Are you saying I can just use “unix of operating system” would accomplish the same thing as the “name of operating system as lowercase contains “linux””?

Correct.

As @JasonWalker already mentioned, if all you want to do is run a few commands you can put all the commands separated by if statements in one fixlet and issue to your target systems.

Your example looks sound; the first half would run on targeted linux systems, while the latter would run on the windows boxes.

Note that you would need an endif statement as well, so

if {unix of operating system}
delete “{(client folder of current site as string) & “/__appendfile”}”
appendfile #!/bin/sh
appendfile /opt/eagle/PACEv2015/eaglemgr/stop ALL & pid=$!
wait chmod 755 “{(client folder of current site as string) & “/__appendfile”}”
wait sh “{(client folder of current site as string) & “/__appendfile”}”
endif

if {windows of operating system}
waithidden net stop “emshell2”
waithidden net stop “Eagle P A C E”
waithidden net stop “ReportExportService 1”
endif

What is the secret to start services and processes as a specific user? There is a ‘eagleservice’ user account that I need to have start these for both the Linux and Windows services. I cannot for the life of me figure out how to do that.

Services need their accounts configured using the Services control panel, registry, or sc.exe.

Linux daemons need to be configured via their /etc/init.d scripts.

Processes can be launched under another account via ‘su’ or ‘runas’, or in actionscript via the ‘override wait’ and ‘runas=(user)’ statements.

If I am using BigFix actionscript do you have an example for each?

if {unix of operating system}
delete “{(client folder of current site as string) & “/__appendfile”}”
**su - eagleservice**
appendfile #!/bin/sh
appendfile /opt/eagle/PACEv2015/eaglemgr/stop ALL & pid=$!
wait chmod 755 “{(client folder of current site as string) & “/__appendfile”}”
wait sh “{(client folder of current site as string) & “/__appendfile”}”
endif

if {windows of operating system}
**runas eagleservice**
waithidden net stop "emshell2"
waithidden net stop "Eagle P A C E"
waithidden net stop “ReportExportService 1”
endif