about summary refs log tree commit diff stats
path: root/html/matt-chat/server.sh
blob: b294acdc9bfa403d2942c910b4b253692970c50b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# check that the ollama server is running, if it isn't, start it in the background and continue with the script
if ! pgrep -f ollama; then
    ollama start &
fi

# check that port 38478 is free
if lsof -i :38478; then
    echo "Port 38478 is already in use. Please choose a different port."
    exit 1
fi

# Start a simple HTTP server using Python on port 38478 and run it in the background
python3 -m http.server 38478 &


#   nvim ~/Library/LaunchAgents/com.user.server.plist
#   cp com.user.server.plist ~/Library/LaunchAgents/
#   launchctl load ~/Library/LaunchAgents/com.user.server.plist
#   launchctl start com.user.server
#   launchctl list | grep com.user.server
#   launchctl unload ~/Library/LaunchAgents/com.user.server.plist