screen-monitor/install.sh

29 lines
738 B
Bash
Raw Normal View History

2024-08-02 00:20:44 +00:00
#!/bin/bash
# Install Python dependencies
2024-08-02 00:46:39 +00:00
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/
2024-08-02 00:20:44 +00:00
# Copy the systemd service file
2024-08-02 00:46:39 +00:00
cp src/screenmonitor.service ~/.config/systemd/user/screenmonitor.service
2024-08-02 00:20:44 +00:00
# Reload systemd to recognize the new service
2024-08-02 00:46:39 +00:00
systemctl --user daemon-reload
2024-08-02 00:20:44 +00:00
# Enable the service to start on boot
2024-08-02 00:46:39 +00:00
systemctl --user enable screenmonitor
2024-08-02 00:20:44 +00:00
# Start the service
2024-08-02 00:46:39 +00:00
systemctl --user start screenmonitor
2024-08-02 00:20:44 +00:00
2024-08-02 00:46:39 +00:00
echo "Service installed and started successfully for user $USER."