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

init-Script overhauling

parent dfc0a162
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
INSTANZ="DataManager"
Pidfile=/root/zeromq-data-transfer/DataManager.pid
Pidfile=/space/projects/zeromq-data-transfer/DataManager.pid
#Pidfile=/root/zeromq-data-transfer/DataManager.pid
DATAMANAGER=/root/zeromq-data-transfer/src/sender/DataManager.py
DATAMANAGER=/space/projects/zeromq-data-transfer/src/sender/DataManager.py
#DATAMANAGER=/root/zeromq-data-transfer/src/sender/DataManager.py
if [ -f $Pidfile ]
then
......@@ -10,53 +12,46 @@ then
fi
start() {
if [ -f $Pidfile ] ; then
if test `ps -e | grep -c $Pid` = 1; then
echo "Not starting $INSTANZ - instance already running"
# echo "Not starting $INSTANZ - instance already running with PID: $Pid"
else
echo "Starting $INSTANZ"
nohup /usr/bin/python ${DATAMANAGER} &> /dev/null &
$(ps -ef | grep '${DATAMANAGER}' | awk '{ print $2 }') > $PIDfile
fi
else
echo "Starting $INSTANZ"
nohup /usr/bin/python ${DATAMANAGER} &> /dev/null &
echo $! > $Pidfile
fi
start()
{
if [ -f $Pidfile ] && test `ps -e | grep -c $Pid` = 1; then
echo "Not starting $INSTANZ - instance already running"
# echo "Not starting $INSTANZ - instance already running with PID: $Pid"
else
echo "Starting $INSTANZ"
nohup /usr/bin/python ${DATAMANAGER} &
echo $! > $Pidfile
fi
}
stop()
{
if [ -f $Pidfile ] ; then
echo "Stopping $INSTANZ"
pkill python
# echo ${pid}
# kill -15 $Pid
rm $Pidfile
# echo $!
else
echo "Cannot stop $INSTANZ - no Pidfile found!"
fi
if [ -f $Pidfile ] ; then
echo "Stopping $INSTANZ"
# pkill python
kill -15 $Pid
rm $Pidfile
else
echo "Cannot stop $INSTANZ - no Pidfile found!"
fi
}
status()
{
if [ -f $Pidfile ] ; then
if test `ps -e | grep -c $Pid` = 0; then
echo "$INSTANZ not running"
else
# echo "$INSTANZ running with PID: [$Pid]"
echo "$INSTANZ running"
fi
else
echo "$Pidfile does not exist! Cannot process $INSTANZ status!"
exit 1
fi
}
if [ -f $Pidfile ] ; then
if test `ps -e | grep -c $Pid` = 0; then
echo "$INSTANZ not running"
else
# echo "$INSTANZ running with PID: [$Pid]"
echo "$INSTANZ running"
fi
else
echo "$INSTANZ not running"
# echo "$Pidfile does not exist! Cannot process $INSTANZ status!"
# exit 1
fi
}
case "$1" in
......
......@@ -64,7 +64,7 @@ class worker(multiprocessing.Process):
content = fileDescriptor.read()
self.log.debug("worker-" + str(self.id) + ": file " + filepath + " read")
# print "metadata", str(metadata)
# print "data", str(data)[:100]
print "data", str(data)[:100]
......@@ -83,12 +83,12 @@ class worker(multiprocessing.Process):
if __name__ == "__main__":
# signalHost = "zitpcx19282.desy.de"
signalHost = "zitpcx19282.desy.de"
# signalHost = "lsdma-lab04.desy.de"
signalHost = "asap3-bl-prx07.desy.de"
# signalHost = "asap3-bl-prx07.desy.de"
targets = [["asap3-bl-prx07.desy.de", "50101", 1], ["asap3-bl-prx07.desy.de", "50102", 1], ["asap3-bl-prx07.desy.de", "50103", 1]]
# targets = [["zitpcx19282.desy.de", "50101", 1], ["zitpcx19282.desy.de", "50102", 1], ["zitpcx19282.desy.de", "50103", 1]]
# targets = [["asap3-bl-prx07.desy.de", "50101", 1], ["asap3-bl-prx07.desy.de", "50102", 1], ["asap3-bl-prx07.desy.de", "50103", 1]]
targets = [["zitpcx19282.desy.de", "50101", 1], ["zitpcx19282.desy.de", "50102", 1], ["zitpcx19282.desy.de", "50103", 1]]
# targets = [["zitpcx19282.desy.de", "50101", 1], ["zitpcx19282.desy.de", "50102", 1], ["zitpcx19282.desy.de", "50103", 1], ["lsdma-lab04.desy.de", "50104", 1]]
# transferType = "queryNext"
......@@ -96,8 +96,8 @@ if __name__ == "__main__":
# transferType = "streamMetadata"
transferType = "queryMetadata"
# basePath = BASE_PATH + os.sep + "data" + os.sep + "target"
basePath = "/asap3/petra3/gpfs/p00/2016/commissioning/c20160205_000_smbtest/"
basePath = BASE_PATH + os.sep + "data" + os.sep + "target"
# basePath = "/asap3/petra3/gpfs/p00/2016/commissioning/c20160205_000_smbtest/"
w1 = multiprocessing.Process(target=worker, args=(0, transferType, basePath, signalHost, "50101"))
w2 = multiprocessing.Process(target=worker, args=(1, transferType, basePath, signalHost, "50102"))
......
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