Prevent sleep on all devices (Ollama and Onyx)

Extracted pmset config into steps/step_sleep.sh and call it from
setup.sh, setup_ollama.sh, and setup_onyx.sh so both devices in a
split setup stay awake.
This commit is contained in:
cediackermann 2026-04-24 13:08:33 +02:00
parent 6e02572bd7
commit fbdde55b82
5 changed files with 16 additions and 4 deletions

View file

@ -50,6 +50,7 @@ source "$REPO/steps/step_onyx.sh"
source "$REPO/steps/step_models.sh" source "$REPO/steps/step_models.sh"
source "$REPO/steps/step_webconfig.sh" source "$REPO/steps/step_webconfig.sh"
source "$REPO/steps/step_rag.sh" source "$REPO/steps/step_rag.sh"
source "$REPO/steps/step_sleep.sh"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Main setup # Main setup
@ -73,6 +74,7 @@ install_homebrew
install_ollama install_ollama
install_docker install_docker
install_onyx install_onyx
prevent_sleep
setup_models setup_models
web_config "host.docker.internal" web_config "host.docker.internal"
rag_upload rag_upload

View file

@ -45,6 +45,7 @@ source "$REPO/steps/preflight.sh"
source "$REPO/steps/step_homebrew.sh" source "$REPO/steps/step_homebrew.sh"
source "$REPO/steps/step_ollama.sh" source "$REPO/steps/step_ollama.sh"
source "$REPO/steps/step_models.sh" source "$REPO/steps/step_models.sh"
source "$REPO/steps/step_sleep.sh"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Main setup # Main setup
@ -66,6 +67,7 @@ preflight_checks --skip-docker
install_homebrew install_homebrew
install_ollama install_ollama
setup_models setup_models
prevent_sleep
# ============================================================================= # =============================================================================
# Done # Done

View file

@ -64,6 +64,7 @@ source "$REPO/steps/step_docker.sh"
source "$REPO/steps/step_onyx.sh" source "$REPO/steps/step_onyx.sh"
source "$REPO/steps/step_webconfig.sh" source "$REPO/steps/step_webconfig.sh"
source "$REPO/steps/step_rag.sh" source "$REPO/steps/step_rag.sh"
source "$REPO/steps/step_sleep.sh"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Detect where Ollama is running # Detect where Ollama is running
@ -154,6 +155,7 @@ preflight_checks
install_homebrew install_homebrew
install_docker install_docker
install_onyx install_onyx
prevent_sleep
# Resolve Ollama host after Docker is running so host.docker.internal works # Resolve Ollama host after Docker is running so host.docker.internal works
if [ -n "$OLLAMA_HOST_OVERRIDE" ]; then if [ -n "$OLLAMA_HOST_OVERRIDE" ]; then

View file

@ -20,8 +20,4 @@ install_onyx() {
print_success "Onyx installation complete" print_success "Onyx installation complete"
fi fi
print_warning "Configuring power settings to prevent sleep..."
sudo pmset -a sleep 0 disksleep 0
print_success "Sleep prevention configured"
} }

10
steps/step_sleep.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# Step: Prevent the machine from sleeping. Source common.sh before sourcing this file.
prevent_sleep() {
print_step "Preventing Sleep"
print_warning "Configuring power settings to prevent sleep..."
sudo pmset -a sleep 0 disksleep 0
print_success "Sleep prevention configured"
}