#!/bin/sh /etc/rc.common START=99 STOP=10 USE_PROCD=1 EXTRA_COMMANDS="status" EXTRA_HELP=" status Show all app instances status" start_service() { config_load streamlit-forge local enabled config_get enabled main enabled '0' [ "$enabled" = "1" ] || return 0 # Start all enabled app instances config_foreach start_app app } start_app() { local section="$1" local enabled name port config_get enabled "$section" enabled '0' [ "$enabled" = "1" ] || return 0 config_get name "$section" name "$section" config_get port "$section" port '8501' echo "Starting Streamlit app: $name on port $port" slforge start "$name" --quiet } stop_service() { # Stop all running app instances for pid_file in /var/run/streamlit-*.pid; do [ -f "$pid_file" ] || continue local pid=$(cat "$pid_file") [ -n "$pid" ] && kill "$pid" 2>/dev/null rm -f "$pid_file" done } status() { slforge status }