File tree 2 files changed +41
-0
lines changed
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Run a query against each chapter site on the LU server.
4
+ # usage e.g. $0 "print Program.objects.count()"
5
+ # $0 "$(cat script.py)"
6
+
7
+ set -e
8
+
9
+ this_dir=${0%/* }
10
+ base_dir=/lu/sites
11
+
12
+ cd $base_dir || exit 1
13
+ sites=$( ls -d * / | tr -d ' /' )
14
+ echo " $@ "
15
+ for i in $sites ; do
16
+ if [ -f $i /esp/manage.py ] ; then
17
+ echo -n " $i : "
18
+ python $this_dir /single_query.py " $base_dir /$i " " $@ "
19
+ fi
20
+ done
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python2
2
+
3
+ # Run a query against a site in a given directory.
4
+ # usage e.g. $0 /lu/sites/smith "print Program.objects.count()"
5
+ # $0 /lu/sites/smith "$(cat script.py)"
6
+ # Intended primarily to be used by run_queries.sh.
7
+
8
+ import sys
9
+ sys .path .insert (0 , sys .argv [1 ]+ '/esp/useful_scripts' )
10
+
11
+ try :
12
+ from script_setup import *
13
+ except :
14
+ print "ERROR: no script_setup.py"
15
+ sys .exit (1 )
16
+
17
+ try :
18
+ exec sys .argv [2 ]
19
+ except :
20
+ print "ERROR: code failed to run"
21
+ raise
You can’t perform that action at this time.
0 commit comments