screen-monitor/install.sh
2024-08-01 17:46:39 -07:00

29 lines
738 B
Bash

#!/bin/bash
# Install Python dependencies
pip3 install --user -r requirements.txt
# Create necessary directories
mkdir -p ~/.screenmonitor/script
mkdir -p ~/.screenmonitor/output
# Copy Python script to the install location
cp src/screenmonitor.py ~/.screenmonitor/script/
# Create user-specific systemd directory
mkdir -p ~/.config/systemd/user/
# Copy the systemd service file
cp src/screenmonitor.service ~/.config/systemd/user/screenmonitor.service
# Reload systemd to recognize the new service
systemctl --user daemon-reload
# Enable the service to start on boot
systemctl --user enable screenmonitor
# Start the service
systemctl --user start screenmonitor
echo "Service installed and started successfully for user $USER."