Wine Logger Script
Wine Logger Script with systemd Timer
This page explains how to deploy and use the Wine logging script together with a systemd timer service. The script records information about active wineserver processes, including their prefix, Wine binary, version, and environment variables. It also supports log rotation (keeping only the last 5 logs) and an optional argument to specify a custom log directory.
Prerequisites
- A Linux system with systemd.
- Wine installed (system Wine, Lutris Wine, Proton, etc.).
- Root privileges to install systemd units.
- The logging script saved as
/usr/local/bin/wine_logger.shand marked executable:
chmod +x /usr/local/bin/wine_logger.sh
Script Usage
Run manually:
/usr/local/bin/wine_logger.sh [log_folder]
- If
log_folderis provided, logs are saved there. - If not provided, logs are saved inside each Wine prefix folder.
Create the systemd Service
Create the file /etc/systemd/system/wine-logger.service:
[Unit] Description=Wine Prefix Logger Service [Service] Type=oneshot ExecStart=/usr/local/bin/wine_logger.sh
This defines the service that runs the script once when triggered.
Create the systemd Timer
Create the file /etc/systemd/system/wine-logger.timer:
[Unit] Description=Periodic Wine Prefix Logger [Timer] OnBootSec=30s OnUnitActiveSec=60s [Install] WantedBy=timers.target
This timer runs the service 30 seconds after boot and then every 60 seconds.
Enable and Start
Reload systemd and enable the timer:
sudo systemctl daemon-reload
sudo systemctl enable --now wine-logger.timer
Verify
Check that the timer is active:
systemctl list-timers | grep wine-logger
View logs generated by the service:
journalctl -u wine-logger.service
Notes
- Each run of the script creates a new log file unless one already exists.
- Only the last 5 logs are kept per directory; older logs are deleted automatically.
- If multiple Wine prefixes are active, one log is created per wineserver process.
- You can adjust the timer interval by changing
OnUnitActiveSec.