Script execution

This commit is contained in:
kalt_r
2016-06-28 11:12:31 +02:00
parent 25d8bd352c
commit ccc54a213d
+32
View File
@@ -9,6 +9,38 @@ stop = 180.0
step = 10.0
def elogllrf(subject, message, attachments = [], system, subsystem, section, machine = "SwissFEL", logbook = "LLRF", encoding=1):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" + controller.getUser().name
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook+ '" '
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=' + machine + '" '
cmd = cmd + '-a "Domain=All"'
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-x -n ' + str(encoding)
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
print "SECTION = ", SECTION
print "Start = ", start