John Doe
2013-07-17 07:11:24 UTC
Hi,
Im a bit new to salt and trying to write my own module.
so far it looks like
checkProcess = 'ps -ef | grep Main'
startProcess = 'pushd /test/process && ant run-process'
stopProcess = ' kill -9 Main'
def ctrl(operation):
if operation == 'start':
return __salt__['cmd.run'](startProcess)
if operation == 'stop'
return __salt__['cmd.run'](stopProcess)
i would like to add a condition to check if the process is up before
starting it but cant figure out how to return the output to the python
module.
meaning i want to add an if condintion to use checkProcess and if the
output for the 'ps -ef | grep Main' is 12345 Main to echo process is
already running, if it returns none to start the process.
appriciate any help
thanks a lot
John...
Im a bit new to salt and trying to write my own module.
so far it looks like
checkProcess = 'ps -ef | grep Main'
startProcess = 'pushd /test/process && ant run-process'
stopProcess = ' kill -9 Main'
def ctrl(operation):
if operation == 'start':
return __salt__['cmd.run'](startProcess)
if operation == 'stop'
return __salt__['cmd.run'](stopProcess)
i would like to add a condition to check if the process is up before
starting it but cant figure out how to return the output to the python
module.
meaning i want to add an if condintion to use checkProcess and if the
output for the 'ps -ef | grep Main' is 12345 Main to echo process is
already running, if it returns none to start the process.
appriciate any help
thanks a lot
John...
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.