45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
|
|
#!/bin/python3
|
||
|
|
'''
|
||
|
|
Created on Apr 5, 2016
|
||
|
|
author: tpweis
|
||
|
|
file name: scat_stopbot.py
|
||
|
|
This functions sends initiates a recipe to run a bot
|
||
|
|
This function also represent a segment of the SCAT. The SCAT contains
|
||
|
|
any required IP or URN identifiers.
|
||
|
|
'''
|
||
|
|
import os
|
||
|
|
import subprocess
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0,'/sl/lib')
|
||
|
|
|
||
|
|
from sleds_utilities import *
|
||
|
|
|
||
|
|
def main():
|
||
|
|
"function main"
|
||
|
|
|
||
|
|
argv = sys.argv[1:]
|
||
|
|
IPADDR, USER, URN, MONGO = slscatargs(argv)
|
||
|
|
rc = scat_stopbot(IPADDR, USER, URN, MONGO)
|
||
|
|
print("scat_stopbot: " + str(rc))
|
||
|
|
slscatlog('I',"scat_stopbot: " + IPADDR + ", " + USER + ", " + URN + ", " + MONGO + ", rc = " + str(rc))
|
||
|
|
exit()
|
||
|
|
|
||
|
|
def scat_stopbot(ipaddr, user, urn, mongo):
|
||
|
|
"function scat_stopbot()"
|
||
|
|
|
||
|
|
cmd="bot_stop"
|
||
|
|
ret_data = slscatfunction(cmd, ipaddr, user, urn, mongo)
|
||
|
|
slscatlog('D', "return value: " + ret_data)
|
||
|
|
|
||
|
|
print(ret_data)
|
||
|
|
if "SUCCESS" in ret_data:
|
||
|
|
return(0)
|
||
|
|
else:
|
||
|
|
return(1)
|
||
|
|
exit()
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
# execute only if run as a script
|
||
|
|
main()
|
||
|
|
|