Products.Jobber.jobs.ShellCommandJob is a useful base class for Jobs that run commands in a child shell. Subclasses should set the cmd attribute on the instance. A ShellCommandJob can also be scheduled directly, passing in a list representing the command as the first argument.
Example 7.3. A Job that models a device in the background
from Products.Jobber.jobs import ShellCommandJob
class ModelDeviceJob(ShellCommandJob):
def __init__(self, devname):
self.cmd = ['zenmodeler', 'run', '-d', devname]
super(ShellCommandJob, self).__init__()
# Or, to run a command as a one-off:
def modelDevice(dmd, devname):
dmd.JobManager.addJob(ShellCommandJob,
['zenmodeler', 'run', '-d', devname])ShellCommandJob's implementation of the interrupt() method kills the child process (kindly, if possible).