mirror of
https://github.com/ParisNeo/ollama_proxy_server.git
synced 2025-09-06 05:12:14 +00:00
Update setup_service.sh
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Configuration with parameters
|
# Configuration with parameters
|
||||||
SERVICE_NAME="ops"
|
SERVICE_NAME="ollama-proxy-server"
|
||||||
USER="ops"
|
USER="ops"
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
@@ -13,12 +13,12 @@ WORKING_DIR=$1
|
|||||||
LOG_DIR="$WORKING_DIR/logs"
|
LOG_DIR="$WORKING_DIR/logs"
|
||||||
SCRIPT_PATH="$WORKING_DIR/ollama-proxy-server/main.py"
|
SCRIPT_PATH="$WORKING_DIR/ollama-proxy-server/main.py"
|
||||||
|
|
||||||
echo "Setting up System Monitor service..."
|
echo "Setting up Ollama Proxy Server..."
|
||||||
|
|
||||||
# Create dedicated user if it doesn't exist already
|
# Create dedicated user if it doesn't exist already
|
||||||
if ! id "$USER" &>/dev/null; then
|
if ! id "$USER" &>/dev/null; then
|
||||||
echo "Creating user $USER..."
|
echo "Creating user $USER..."
|
||||||
sudo useradd -r -s /bin/false "/home/$SERVICE_NAME"
|
sudo useradd -r -s /bin/false "/home/$USER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure the working directory is writable by the dedicated user
|
# Ensure the working directory is writable by the dedicated user
|
||||||
@@ -36,7 +36,7 @@ sudo chown -R "$USER:$USER" "$LOG_DIR"
|
|||||||
echo "Creating systemd service..."
|
echo "Creating systemd service..."
|
||||||
sudo tee /etc/systemd/system/$SERVICE_NAME.service > /dev/null << EOF
|
sudo tee /etc/systemd/system/$SERVICE_NAME.service > /dev/null << EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=GPU and Ollama Monitor
|
Description=Ollama Proxy Server
|
||||||
After=network.target
|
After=network.target
|
||||||
Wants=network.target
|
Wants=network.target
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Type=simple
|
|||||||
User=$USER
|
User=$USER
|
||||||
Group=$USER
|
Group=$USER
|
||||||
WorkingDirectory=$WORKING_DIR
|
WorkingDirectory=$WORKING_DIR
|
||||||
ExecStart=/bin/bash $WORKING_DIR/run.sh --interval 10 --db-path $WORKING_DIR/gpu_stats.db --log-dir $LOG_DIR
|
ExecStart=/bin/bash $WORKING_DIR/run.sh
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
|
Reference in New Issue
Block a user