From 4eaf0341fb09e263f13b0e05cd5ebd454146127f Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Fri, 13 Jan 2012 17:36:42 -0500 Subject: [PATCH] New script from Jude Nelson --- exec/prox | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 exec/prox diff --git a/exec/prox b/exec/prox new file mode 100755 index 0000000..8d1654a --- /dev/null +++ b/exec/prox @@ -0,0 +1,37 @@ +#!/usr/bin/python + +MAX_LOCKED_MEMSIZE = 1024 * 1024 * 1024 # 1 GB +SHMMAX = 1024 * 1024 * 1024 # 1 GB + +SLICE = "princeton_vcoblitz" + +import os +import sys +import resource + +if __name__ == "__main__": + + # expand lockable memory + resource.setrlimit( resource.RLIMIT_MEMLOCK, (MAX_LOCKED_MEMSIZE, MAX_LOCKED_MEMSIZE) ) + + # ensure that shmmax is big enough. + os.system( "vspace -e " + SLICE + " --ipc sysctl -w kernel.shmmax=" + str(SHMMAX) ) + + # we'll echo argv into the prox pipe + args = sys.stdin.read().split() + + print "args = " + str(args) + + pid = os.fork() + if pid == 0: + # child + print "child forked" + + os.execv( args[0], args ) + #os.execve( args[0], args, {'LD_LIBRARY_PATH': "/vservers/" + SLICE + "/lib:/vservers/" + SLICE + "/lib64:/vservers/" + SLICE + "/usr/lib:/vservers/" + SLICE + "/usr/lib64"} ) + + else: + # parent + print "pid = " + str(pid) + os.wait() + sys.exit(0) -- 2.43.0