Sleds/buildvm/scat/bot_status.py

42 lines
721 B
Python

#!/bin/python3
'''
Created on Mar 30, 2014
author: tpweis
file name: bot_status.py
'''
import os
import subprocess
import sys
sys.path.insert(0,'/sl/lib')
from sleds_utilities import *
def main():
"function main"
slsetvars()
argv = sys.argv[1:]
USER = argv[0]
URN = argv[1]
botstring="--user=" + USER
rc = "OFF"
botstring = "--user=" + USER
p2 = subprocess.Popen(["ps", "-U", "sequencelogic", "a"], stdout=subprocess.PIPE)
data=p2.communicate()[0]
data=data.decode()
data=data.rstrip()
if botstring in data:
# The process is alive.
rc = "ON"
print(rc)
exit()
if __name__ == '__main__':
# execute only if run as a script
main()