From 30ed10d3644da3d532b4a36fd3b24ac346304bde Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Fri, 8 Dec 2023 17:58:27 +0000 Subject: [PATCH] Moodle, forgotten Linia, of user who runs the installation --- orchestra/contrib/webapps/backends/moodle.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/orchestra/contrib/webapps/backends/moodle.py b/orchestra/contrib/webapps/backends/moodle.py index e879dc09..9579a3b5 100644 --- a/orchestra/contrib/webapps/backends/moodle.py +++ b/orchestra/contrib/webapps/backends/moodle.py @@ -33,7 +33,15 @@ class MoodleController(WebAppServiceMixin, ServiceController): {% endif %} """ )) - context.update({'perms' : perms.render(Context(context))}) + linenohub = Template(textwrap.dedent("""\ + {% if sftpuser %} + nohup su - {{sftpuser}} --shell /bin/bash << 'EOF' > $stdout 2> $stderr & + {% else %} + nohup su - {{user}} --shell /bin/bash << 'EOF' > $stdout 2> $stderr & + {% endif %} + """ + )) + context.update({'perms' : perms.render(Context(context)), 'linenohub' : linenohub.render(Context(context)) }) self.append(textwrap.dedent("""\ if [[ $(ls "%(app_path)s" | wc -l) -gt 1 ]]; then echo "App directory not empty." 2> /dev/null @@ -88,8 +96,7 @@ class MoodleController(WebAppServiceMixin, ServiceController): # Run install moodle cli command on the background, because it takes so long... stdout=$(mktemp) stderr=$(mktemp) - # nohup su - %(user)s --shell /bin/bash << 'EOF' > $stdout 2> $stderr & - nohup su - %(sftpuser)s --shell /bin/bash << 'EOF' > $stdout 2> $stderr & + %(linenohub)s php -d max_input_vars=5000 %(app_path)s/admin/cli/install_database.php \\ --fullname="%(site_name)s" \\ --shortname="%(site_name)s" \\