summaryrefslogtreecommitdiff
path: root/ci/docker/starteduvpn.sh
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-25 14:23:57 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-25 14:23:57 +0100
commit1708d88ca975e11af912d10f0d793ac6ee775919 (patch)
treee64171a5a0093d22fd11a0f3d69d11343102a3fa /ci/docker/starteduvpn.sh
parentbd8eda82e5d08d2ca33022b0533c831303a73019 (diff)
Add comments and minor fixups
Diffstat (limited to 'ci/docker/starteduvpn.sh')
-rw-r--r--ci/docker/starteduvpn.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/ci/docker/starteduvpn.sh b/ci/docker/starteduvpn.sh
index 39eb53e..580150b 100644
--- a/ci/docker/starteduvpn.sh
+++ b/ci/docker/starteduvpn.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+# Check if credentials are set
+# If not fail with exit code 1
if [[ -z "${PORTAL_USER}" ]]; then
printf "Error: No portal username set, set the PORTAL_USER env var\n"
exit 1
@@ -10,16 +12,23 @@ if [[ -z "${PORTAL_PASS}" ]]; then
exit 1
fi
+# Start the preliminary systemd units
systemctl start php-fpm
systemctl start httpd
systemctl start crond
+# Start the daemon in the background and get the PID
vpn-daemon &
pid_daemon=$!
+
+# Wait a bit
sleep 5
+# Apply the vpn configuration
vpn-maint-apply-changes
+# Add the user with the env variables
sudo -u apache vpn-user-portal-account --add "${PORTAL_USER}" --password "${PORTAL_PASS}"
+# Wait for the daemon to finish
wait $pid_daemon