replace syncadmins.sh with syncadmins.py
authorStephen Soltesz <soltesz@cs.princeton.edu>
Sun, 20 Sep 2009 17:34:46 +0000 (17:34 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Sun, 20 Sep 2009 17:34:46 +0000 (17:34 +0000)
update rtcron.sh to run python scripts
remove callplcsh.py

cron.d/syncadmins.py [moved from callplcsh.py with 68% similarity, mode: 0755]
cron.d/syncadmins.sh [deleted file]
rtcron.sh

old mode 100644 (file)
new mode 100755 (executable)
similarity index 68%
rename from callplcsh.py
rename to cron.d/syncadmins.py
index 6d18625..7490496
@@ -7,7 +7,6 @@ import sys
 try:
        # if this file deos not exist, then we will jump to the exception and use
        # the local PLCSH without passing any additional arguments.
-
        os.stat("/etc/planetlab/master.py")
        sys.path.append("/etc/planetlab")
        import master
@@ -15,15 +14,15 @@ try:
        # Use the values given to us in the /etc/planetlab/master.py file taken from
        # the master PLC and use them to construct the proper arguments to plcsh so
        # that we can get a user list from managing, CoPLC
-
        user=master.PLC_ROOT_USER
        passwd=master.PLC_ROOT_PASSWORD
        url = "https://" + master.PLC_API_HOST + ":" \
                        + master.PLC_API_PORT + master.PLC_API_PATH
 
-       cmd = "plcsh --user=%s --password=%s --url=%s %s" % (user, 
-                       passwd, url, " ".join(sys.argv[1:]))
+       plcsh_args = "--user=%s --password=%s --url=%s %s" % (user, passwd, url, " ".join(sys.argv[1:]))
 except:
-       cmd = "plcsh %s" % " ".join(sys.argv[1:])
+       plcsh_args = "%s" % " ".join(sys.argv[1:])
 
-os.system(cmd)
+dir = "/usr/share/plcrt"
+os.system("chmod 755 %s/getpersons.py" % dir)
+os.system("%s/getpersons.py %s -- admin | %s/adduserstort.pl priv -" % ( dir, plcsh_args, dir) )
diff --git a/cron.d/syncadmins.sh b/cron.d/syncadmins.sh
deleted file mode 100755 (executable)
index 9d3683d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-RTDIR=/usr/share/plcrt
-${RTDIR}/callplcsh.py ${RTDIR}/getpersons.py admin | ${RTDIR}/adduserstort.pl priv -
index 6cd578f..7a0752e 100755 (executable)
--- a/rtcron.sh
+++ b/rtcron.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
 D=/usr/share/plcrt/
-for f in $D/cron.d/*.sh ; do
-       bash -c "$f"
+for f in $D/cron.d/*.py ; do
+       $f
 done