- Change user from root to dalim - Update working directory to /home/dalim/BISSELL-WRIKE - Use virtual environment python at /home/dalim/BISSELL-WRIKE/bissell-wrike/bin/python3 - Update all installation commands to use venv - Add venv activation steps throughout guide - Add ownership commands for dalim user
9.1 KiB
Installation Guide - LGL Team Monitor Service
This guide covers installing the wrike_monitor_lgl.py service for the LGL Team (Production) board.
Prerequisites
- Linux server with systemd
- Python 3.6 or higher
- User account:
dalim - Sudo access for service installation
- Active Wrike API token with access to LGL Team space
Installation Steps
1. Prepare the Installation Directory
# Create installation directory
sudo mkdir -p /home/dalim/BISSELL-WRIKE
# Create virtual environment
cd /home/dalim/BISSELL-WRIKE
python3 -m venv bissell-wrike
# Copy files to server
sudo cp wrike_monitor_lgl.py /home/dalim/BISSELL-WRIKE/
sudo cp requirements.txt /home/dalim/BISSELL-WRIKE/
sudo cp wrike-monitor-lgl.service /etc/systemd/system/
# Set ownership
sudo chown -R dalim:dalim /home/dalim/BISSELL-WRIKE
2. Install Python Dependencies
cd /home/dalim/BISSELL-WRIKE
# Activate virtual environment
source bissell-wrike/bin/activate
# Install dependencies
pip install -r requirements.txt
3. Configure the Script
Edit /home/dalim/BISSELL-WRIKE/wrike_monitor_lgl.py and update paths (lines 41-44):
# === PATHS (EDIT FOR SERVER) ===
HOT_FOLDER = Path("/path/to/json_files")
PROCESSED_FOLDER = Path("/path/to/processed")
FAILED_FOLDER = Path("/path/to/processed/Failed")
REPORTS_DIR = Path("/path/to/processed/reports")
Note: API token and LGL Team configuration are already set in the script.
4. Create Required Directories
# Create directories (adjust paths to match your configuration)
sudo mkdir -p /path/to/json_files
sudo mkdir -p /path/to/processed
sudo mkdir -p /path/to/processed/Failed
sudo mkdir -p /path/to/processed/reports
# Set permissions
sudo chmod 755 /path/to/json_files
sudo chmod 755 /path/to/processed
5. Test the Script
Before enabling the service, test the script manually:
cd /home/dalim/BISSELL-WRIKE
# Activate virtual environment
source bissell-wrike/bin/activate
# Run the script
python wrike_monitor_lgl.py
Expected output:
2025-12-17 15:00:00 - INFO - Wrike Monitor initialized - Target: LGL Team
2025-12-17 15:00:00 - INFO - 🔍 Scanning for existing JSON files...
2025-12-17 15:00:00 - INFO - Found 0 existing files
2025-12-17 15:00:00 - INFO - ✅ No existing files to process
2025-12-17 15:00:00 - INFO - 🎯 Startup complete - switching to real-time monitoring
2025-12-17 15:00:00 - INFO - 🛡️ Real-time monitoring active on: /path/to/json_files
2025-12-17 15:00:00 - INFO - 📧 Daily reports at 19:00 to daveporter@oliver.agency
Press Ctrl+C to stop the test.
6. Install and Enable the Service
# Reload systemd to recognize the new service
sudo systemctl daemon-reload
# Enable the service to start on boot
sudo systemctl enable wrike-monitor-lgl.service
# Start the service
sudo systemctl start wrike-monitor-lgl.service
7. Verify Service Status
# Check service status
sudo systemctl status wrike-monitor-lgl.service
# View real-time logs
sudo journalctl -u wrike-monitor-lgl.service -f
# View recent logs
sudo journalctl -u wrike-monitor-lgl.service -n 100
Service Management Commands
# Start the service
sudo systemctl start wrike-monitor-lgl.service
# Stop the service
sudo systemctl stop wrike-monitor-lgl.service
# Restart the service
sudo systemctl restart wrike-monitor-lgl.service
# Check status
sudo systemctl status wrike-monitor-lgl.service
# View logs
sudo journalctl -u wrike-monitor-lgl.service -f
# Disable service (won't start on boot)
sudo systemctl disable wrike-monitor-lgl.service
# Enable service (will start on boot)
sudo systemctl enable wrike-monitor-lgl.service
Monitoring and Logs
View Service Logs
# Real-time logs
sudo journalctl -u wrike-monitor-lgl.service -f
# Last 100 lines
sudo journalctl -u wrike-monitor-lgl.service -n 100
# Logs since today
sudo journalctl -u wrike-monitor-lgl.service --since today
# Logs from specific date
sudo journalctl -u wrike-monitor-lgl.service --since "2025-12-17"
Check Application Logs
Application logs are stored in the configured REPORTS_DIR:
# View monitor log
tail -f /path/to/processed/reports/wrike_monitor.log
# View daily reports
ls -lt /path/to/processed/reports/daily_report_*.txt
Daily Reports
The service sends daily email reports at 7:00 PM to the configured email addresses.
Email settings are configured in the script (lines 71-82):
- SMTP Server: smtp.mailgun.org
- Recipients: daveporter@oliver.agency
Reports include:
- Total files processed
- Tasks created vs skipped (duplicates)
- Folder breakdown
- Hourly breakdown
- Error details (if any)
Duplicate Detection
The LGL Team version includes recursive duplicate detection:
- ✅ Searches entire "Business Areas" folder
- ✅ Checks all subfolders at any depth
- ✅ Extracts OMG# from HTML links
- ✅ Skips if OMG# exists anywhere in Business Areas
- ✅ No duplicates will be created
Example log output:
2025-12-17 15:30:45 - INFO - ✓ Found existing deliverable with OMG# 1988861 in Business Areas: Bissell Pet Products (MQAAAABpUdQ9)
2025-12-17 15:30:45 - INFO - ⊙ Deliverable already exists: PowerClean Corded Mass User Guide (#5791330) - skipping
Troubleshooting
Service Won't Start
# Check service status and errors
sudo systemctl status wrike-monitor-lgl.service
# View detailed error logs
sudo journalctl -u wrike-monitor-lgl.service -n 50
Common issues:
- Python dependencies not installed → Activate venv and run
pip install -r requirements.txt - Incorrect paths in script → Edit paths in wrike_monitor_lgl.py
- Permissions issues → Check folder permissions:
sudo chown -R dalim:dalim /home/dalim/BISSELL-WRIKE - Virtual environment not activated → Service uses venv python at
/home/dalim/BISSELL-WRIKE/bissell-wrike/bin/python3 - API token invalid → Verify token in script configuration
Service Crashes/Restarts
The service is configured to automatically restart (Restart=always) with a 10-second delay.
To investigate crashes:
# View crash logs
sudo journalctl -u wrike-monitor-lgl.service | grep -i "error\|exception\|failed"
Files Not Being Processed
-
Check service is running:
sudo systemctl status wrike-monitor-lgl.service -
Verify folder monitoring:
# Should show monitoring message in logs sudo journalctl -u wrike-monitor-lgl.service | grep "monitoring active" -
Check file permissions:
ls -la /path/to/json_files/ -
Test manually:
# Stop service sudo systemctl stop wrike-monitor-lgl.service # Run manually to see errors cd /home/dalim/BISSELL-WRIKE source bissell-wrike/bin/activate python wrike_monitor_lgl.py
Duplicate Files Still Being Created
If duplicates are being created despite the detection logic:
-
Check logs for duplicate detection:
sudo journalctl -u wrike-monitor-lgl.service | grep "Found existing deliverable" -
Verify Business Areas folder exists in Wrike LGL Team space
-
Check OMG# format - should be HTML links, not plain text
-
Test duplicate detection manually:
cd /root/wrike-import python3 test_duplicate_detection.py
Running Staging and LGL Team Together
You can run both services simultaneously:
# Staging version
sudo systemctl start wrike-monitor.service
# LGL Team version
sudo systemctl start wrike-monitor-lgl.service
# Check both are running
sudo systemctl status wrike-monitor.service
sudo systemctl status wrike-monitor-lgl.service
Each service monitors its own hot folder and targets its own Wrike space.
Updating the Service
To update the script:
# Stop the service
sudo systemctl stop wrike-monitor-lgl.service
# Update the script
sudo cp new_wrike_monitor_lgl.py /home/dalim/BISSELL-WRIKE/wrike_monitor_lgl.py
# Set ownership
sudo chown dalim:dalim /home/dalim/BISSELL-WRIKE/wrike_monitor_lgl.py
# Start the service
sudo systemctl start wrike-monitor-lgl.service
# Verify it's running
sudo systemctl status wrike-monitor-lgl.service
Uninstalling
To remove the service:
# Stop and disable the service
sudo systemctl stop wrike-monitor-lgl.service
sudo systemctl disable wrike-monitor-lgl.service
# Remove service file
sudo rm /etc/systemd/system/wrike-monitor-lgl.service
# Reload systemd
sudo systemctl daemon-reload
# Optionally remove installation directory
sudo rm -rf /home/dalim/BISSELL-WRIKE
Support
For issues or questions:
- Check logs:
sudo journalctl -u wrike-monitor-lgl.service -f - Review the main README.md
- Check Wrike API status: https://status.wrike.com
Last Updated: December 2025 Service Name: wrike-monitor-lgl.service Target Board: LGL Team (Production)