Script execution

This commit is contained in:
kalt_r
2016-06-28 11:20:33 +02:00
parent b7ef475a91
commit e08c995b48

View File

@@ -9,35 +9,6 @@ stop = 180.0
step = 10.0
def elogllrf(subject, message, system, subsystem, section, attachments = []):
"""
Add entry to ELOG.
"""
author = "pshell" + controller.getUser().name
entry = ""
cmd = 'G_CS_ELOG_add -l "LLRF" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Subject=' + subject + '" '
cmd = cmd + '-a "Section=' + section + '" '
cmd = cmd + '-a "System=' + system + '" '
cmd = cmd + '-a "Subsystem=' + subsystem + '" '
cmd = cmd + '-a "Machine=SwissFEL" '
cmd = cmd + '-a "Domain=All"'
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-x -n 1'
cmd = cmd + ' "' + message + '"'
print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out