43 lines
1000 B
Python
43 lines
1000 B
Python
#!/bin/python3
|
|
'''
|
|
# Version: 12Aug2016
|
|
Created on Apr 5, 2016
|
|
author: tpweis
|
|
file name: scat_sensor.py
|
|
'''
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
sys.path.insert(0,'/sl/lib')
|
|
|
|
from sleds_utilities import *
|
|
|
|
def main():
|
|
"function main"
|
|
|
|
|
|
# Set up the environmental variables required
|
|
slsetvars()
|
|
|
|
# using the echo command at the other end of the pipe to send a string through stdin.
|
|
# use builtin input command to fetch a line
|
|
arglist = input()
|
|
cmd, temp, args = arglist.partition(" ")
|
|
cmd_str = slscatget() + cmd + ".py"
|
|
slscatlog('D',"scat_sensor run " + cmd_str)
|
|
# Pack in the arguments ONLY if they exist. Otherwise, its simply the command
|
|
if args and args.strip():
|
|
FULL_CMD = cmd_str + " " + args
|
|
else:
|
|
FULL_CMD = cmd_str
|
|
slscatlog('I',"full command: " + FULL_CMD)
|
|
|
|
# execute the command
|
|
subprocess.call([FULL_CMD], shell=True)
|
|
|
|
exit()
|
|
|
|
if __name__ == "__main__":
|
|
# execute only if run as a script
|
|
main()
|