feat: attempt to start unraid-api with background task

This commit is contained in:
Eli Bosley
2024-12-30 11:21:03 -05:00
parent cea11daf15
commit 73a12496d5

View File

@@ -873,18 +873,21 @@ npm link "${api_base_directory}" --force
# bail if expected file does not exist # bail if expected file does not exist
[[ ! -f "${api_base_directory}/package.json" ]] && echo "unraid-api install failed" && exit 1 [[ ! -f "${api_base_directory}/package.json" ]] && echo "unraid-api install failed" && exit 1
${unraid_binary_path} start # Start a background process to wait for /var/local/emhttp/var.ini
( timeout=30 elapsed=0
# start background process to start flash backup while (( elapsed < timeout )); do
echo if [ -f /var/local/emhttp/var.ini ]; then
if [ -f /var/local/emhttp/var.ini ]; then logger "Starting flash backup (if enabled)"
# the system has fully booted, emhttpd and nginx are running echo "/etc/rc.d/rc.flash_backup start" | at -M now &>/dev/null
echo "Starting flash backup (if enabled)" logger "Starting Unraid API"
echo "/etc/rc.d/rc.flash_backup start" | at -M now &>/dev/null ${unraid_binary_path} start
# else exit 0
# the system is booting, emhttpd will install the api and start rc.flash_backup. rc.nginx will start the api. fi
# nothing to do here sleep 1
fi (( elapsed++ ))
done
echo "Timeout waiting for /var/local/emhttp/var.ini"
) &
echo echo
echo "✅ Installation is complete, it is safe to close this window" echo "✅ Installation is complete, it is safe to close this window"