64 lines
1.6 KiB
Desktop File
64 lines
1.6 KiB
Desktop File
# =============================================================================
|
|
# photobooth-app.service - Service systemd pour photobooth-app
|
|
# =============================================================================
|
|
# Installation:
|
|
# cp photobooth-app.service ~/.config/systemd/user/
|
|
# systemctl --user daemon-reload
|
|
# systemctl --user enable photobooth-app
|
|
# systemctl --user start photobooth-app
|
|
#
|
|
# Logs:
|
|
# journalctl --user --unit=photobooth-app -f
|
|
# =============================================================================
|
|
|
|
[Unit]
|
|
Description=Photobooth App - Photomaton
|
|
After=network.target cups.service
|
|
Wants=cups.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=%h/photobooth-data
|
|
ExecStart=%h/.local/bin/photobooth
|
|
# Alternative si installe dans un venv:
|
|
# ExecStart=%h/photobooth-venv/bin/photobooth
|
|
|
|
# --- Redemarrage automatique robuste ---
|
|
Restart=always
|
|
RestartSec=5
|
|
# Nombre max de redemarrages en 60 secondes
|
|
StartLimitIntervalSec=300
|
|
StartLimitBurst=5
|
|
|
|
# --- Limites memoire (protection contre les fuites) ---
|
|
# Limite douce: avertissement a 1.2 Go
|
|
MemoryHigh=1200M
|
|
# Limite dure: kill a 1.5 Go (laisser de la RAM pour le systeme)
|
|
MemoryMax=1500M
|
|
# Limite swap
|
|
MemorySwapMax=512M
|
|
|
|
# --- Watchdog integre ---
|
|
WatchdogSec=120
|
|
# Si le watchdog ne recoit pas de signal, redemarrer
|
|
WatchdogSignal=SIGKILL
|
|
|
|
# --- Environnement ---
|
|
Environment=PYTHONUNBUFFERED=1
|
|
Environment=HOME=%h
|
|
|
|
# --- Securite ---
|
|
NoNewPrivileges=true
|
|
ProtectSystem=strict
|
|
ReadWritePaths=%h/photobooth-data
|
|
ReadWritePaths=%h/.config
|
|
ReadWritePaths=/tmp
|
|
|
|
# --- Nettoyage propre ---
|
|
ExecStopPost=/bin/bash -c 'sleep 2'
|
|
KillMode=mixed
|
|
TimeoutStopSec=30
|
|
|
|
[Install]
|
|
WantedBy=default.target
|