#!/bin/bash # Init hugo config file python init_hugo_toml.py # Start Hugo server in the background. This will import/update Lotusdocs module. # The import of the module is important to get the themes files, because some of # the sub-directories must be adapted to the future doc structure. hugo server > init_hugo.log 2>&1 & # Wait for the end of the initialization process and stop hugo while true; do if grep -q "Web Server is available" init_hugo.log; then # Initialization done echo "Initialization complete. Web Server is available." # Get the PID of the Hugo process and store it in a file for later use pgrep -f "hugo server" | kill # You can stop the loop if you don't need to monitor the log anymore break fi sleep 1 done # We don't need init_hugo.log anymore rm init_hugo.log # Generate Hugo Lotusdoc website structure and config python generate_lotusdocs.py