Skip to content

Commit 727cbb0

Browse files
committed
Update setup_services.sh
1 parent 0a39169 commit 727cbb0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

install/setup_services.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ else
1717
echo "User '$USER' already exists. Skipping user creation."
1818
fi
1919

20-
2120
# Create systemd services for Python scripts with 'hasatellite' user and group
2221
create_service() {
2322
script_name="$1"
2423
service_name="${script_name%.py}" # Remove the .py extension to create the service name
2524
service_file="/etc/systemd/system/${service_name}.service"
25+
venv_path="$VENV_DIR" # Path to the virtual environment's Python interpreter
2626

2727
echo "Creating systemd service for $script_name..."
2828
cat <<EOF | sudo tee "$service_file" > /dev/null
@@ -32,7 +32,7 @@ After=network.target
3232
Wants=network.target
3333
3434
[Service]
35-
ExecStart=/usr/bin/python3 "$PWD/$script_name"
35+
ExecStart=$venv_path "$PWD/$script_name"
3636
Restart=always
3737
User=$USER
3838
Group=$USER_GROUP
@@ -49,7 +49,7 @@ EOF
4949
}
5050

5151
# List of Python scripts you want to create services for
52-
python_scripts=("mqtt-listener.py" "alarm-clock.py" "kiosk-home.py")
52+
python_scripts=("mqtt-listener.py" "spotify-alarm.py" "kiosk-home.py")
5353

5454
# Create systemd services for each script
5555
for script in "${python_scripts[@]}"; do

0 commit comments

Comments
 (0)