[Unit] Description=QR Merge Folder Watcher Documentation=https://github.com/icastinc/qr-merge After=network.target local-fs.target [Service] Type=simple # Run as the web-server user so it can read/write /var/www/html/qr/ User=www-data Group=www-data # Adjust this path to wherever the scripts are deployed on the server WorkingDirectory=/opt/qr-merge # Activate the virtualenv, then run the watcher ExecStart=/opt/qr-merge/venv/bin/python /opt/qr-merge/folder_watcher.py \ --watch-dir /var/www/html/qr \ --base-url http://fileshare.icastinc.com/qr \ --log-level INFO # Restart automatically on failure (e.g. transient inotify errors) Restart=always RestartSec=5 # Forward stdout/stderr to journald StandardOutput=journal StandardError=journal SyslogIdentifier=qr-watcher [Install] WantedBy=multi-user.target