AWS Thinkbox Discussion Forums

Executing a cmd line command on a slave from Monitor script

What would be the best way to write a python script that I can execute from the Monitor that will initiate a cmd line command on a slave I have selected?

I have tasks set on each slave machine that runs a tmp folder cleanup every day. But I’d like the ability to to a spot cleanup via the Monitor

The command is:

schtasks /Run /TN "Temp Clean Up"

Update:

I just noticed the StartOrStopService.py script and think this might hold some code that could help me out. But any input would still be helpful.

Thanks!

Can you just use this built-in command?

Right click on slave > Remote control > Execute command…

I could but two things:

  1. I’d like to have this be just a quick right-click run.

  2. When I tried it I get this error: The Remote Command Whitelist is enabled but contains no entries. Executing arbitrary command text is disallowed"

I’m getting a similar error when I try to run the command via my simple python script.

from System.IO import *
from Deadline.Scripting import *
from Deadline.Jobs import *
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog


def __main__():
    print ("----")
    selectedSlaveInfoSettings = MonitorUtils.GetSelectedSlaveInfoSettings()
    machineNames = SlaveUtils.GetMachineNameOrIPAddresses(selectedSlaveInfoSettings)
    for machineName in machineNames:
        print machineName
        SlaveUtils.SendRemoteCommand( machineName, "Execute cmd /C schtasks /Run /TN 'Temp Clean Up'" )

I believe both of those methods (Python and GUI) interface with the same ‘remote command’ module. Seems like you have enabled white listing of commands, but your desired command is not in that list.

Monitor: Tools > Configure repository options > Client setup > Remote control

More info half-way down this page: https://deadline.thinkboxsoftware.com/feature-blog/2017/9/22/locking-down-your-farm

Great thanks! I’ll check this out when I get back in tomorrow morning.

That was indeed the issue. Thanks for the help!

No worries :slight_smile:

Privacy | Site terms | Cookie preferences