Skip to content
Snippets Groups Projects
Commit 9d2c6984 authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Added wrapper-script

parent 0a1c3ad2
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,9 @@
-- configuration parameters
--
settings {
statusFile = "/var/log/lsyncd.stat",
statusFile = "/space/projects/Live_Viewer/lsyncd.stat",
statusInterval = 1,
nodaemon = true
}
local formats = { jpg = true, tif = true, cbf = true, log = true }
......@@ -44,12 +45,22 @@ gpfs = {
local extension = string.match(event.name, ".*%.([^.]+)$")
if formats[extension] ~= true then return end
spawn(
spawn (
event,
'/bin/mv',
'/usr/bin/python',
'/space/projects/Live_Viewer/wrapper_script.py',
'--mv_source',
event.sourcePath,
'--mv_target',
event.targetPathdir
)
-- spawn(
-- event,
-- '/bin/mv',
-- event.sourcePath,
-- event.targetPathdir
-- )
end
end,
......@@ -71,12 +82,22 @@ gpfs = {
local extension = string.match(event.name, ".*%.([^.]+)$")
if formats[extension] ~= true then return end
spawn(
spawn (
event,
'/bin/mv',
'/usr/bin/python',
'/space/projects/Live_Viewer/wrapper_script.py',
'--mv_source',
event.sourcePath,
'--mv_target',
event.targetPathdir
)
-- spawn(
-- event,
-- '/bin/mv',
-- event.sourcePath,
-- event.targetPathdir
-- )
end
end,
......@@ -89,8 +110,8 @@ gpfs = {
if not agent.isList and agent.etype == "Blanket" then
if exitcode == 0 then
log("Normal", "Startup of '",agent.source,"' finished.")
elseif config.exitcodes and
config.exitcodes[exitcode] == "again"
elseif config.exitcodes and
config.exitcodes[exitcode] == "again"
then
log("Normal", "Retrying startup of '",agent.source,"'.")
return "again"
......@@ -100,7 +121,7 @@ gpfs = {
return
end
local rc = config.exitcodes and config.exitcodes[exitcode]
local rc = config.exitcodes and config.exitcodes[exitcode]
if rc == "die" then
return rc
end
......@@ -126,6 +147,6 @@ sync {
gpfs,
delay=0,
init=false,
source="/rd",
target="/gpfs",
source="/space/projects/Live_Viewer/source",
target="/space/projects/Live_Viewer/target",
}
import argparse
import subprocess
import os
parser = argparse.ArgumentParser()
parser.add_argument("--mv_source", help = "Move source")
parser.add_argument("--mv_target", help = "Move target")
arguments = parser.parse_args()
source = arguments.mv_source
target = arguments.mv_target
watchFolder = "/space/projects/Live_Viewer/source/"
filepathNormalised = os.path.normpath ( source )
( parentDir, filename ) = os.path.split ( filepathNormalised )
commonPrefix = os.path.commonprefix ( [ watchFolder, filepathNormalised ] )
#print "commonPrefix", commonPrefix
relativeBasepath = os.path.relpath ( filepathNormalised, commonPrefix )
#print "relativeBasepath", relativeBasepath
( relativeParent, blub ) = os.path.split ( relativeBasepath )
print "filename ", filename
print "parentDir ", parentDir
print "relativeParent", relativeParent
my_cmd = 'echo "' + arguments.mv_source + '" > /tmp/zeromqllpipe'
print my_cmd
p = subprocess.Popen ( my_cmd, shell=True )
p.communicate()
p = subprocess.Popen ( [ 'mv', arguments.mv_source, arguments.mv_target ],
stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE,
universal_newlines = False )
out, err = p.communicate()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment