first commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# =============================================================================
|
||||
# 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
|
||||
@@ -0,0 +1,14 @@
|
||||
# =============================================================================
|
||||
# photobooth-maintenance.service - Maintenance quotidienne du photomaton
|
||||
# =============================================================================
|
||||
|
||||
[Unit]
|
||||
Description=Photomaton Daily Maintenance
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/home/pi/photomaton/scripts/maintenance.sh
|
||||
# Adapter le chemin ci-dessus selon votre installation
|
||||
# ExecStart=/home/VOTRE_USER/opencode/perso/photomaton/scripts/maintenance.sh
|
||||
|
||||
TimeoutStartSec=300
|
||||
@@ -0,0 +1,16 @@
|
||||
# =============================================================================
|
||||
# photobooth-maintenance.timer - Maintenance quotidienne a 4h du matin
|
||||
# =============================================================================
|
||||
|
||||
[Unit]
|
||||
Description=Photomaton Daily Maintenance Timer
|
||||
|
||||
[Timer]
|
||||
# Tous les jours a 4h du matin
|
||||
OnCalendar=*-*-* 04:00:00
|
||||
# Tolerence de 1 heure (pas critique)
|
||||
AccuracySec=1h
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@@ -0,0 +1,25 @@
|
||||
# =============================================================================
|
||||
# photobooth-watchdog.service - Surveillance de sante du photomaton
|
||||
# =============================================================================
|
||||
# Installation:
|
||||
# sudo cp photobooth-watchdog.service /etc/systemd/system/
|
||||
# sudo cp photobooth-watchdog.timer /etc/systemd/system/
|
||||
# sudo systemctl daemon-reload
|
||||
# sudo systemctl enable photobooth-watchdog.timer
|
||||
# sudo systemctl start photobooth-watchdog.timer
|
||||
# =============================================================================
|
||||
|
||||
[Unit]
|
||||
Description=Photomaton Health Check Watchdog
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/home/pi/photomaton/scripts/health-check.sh
|
||||
# Adapter le chemin ci-dessus selon votre installation
|
||||
# ExecStart=/home/VOTRE_USER/opencode/perso/photomaton/scripts/health-check.sh
|
||||
|
||||
# Timeout: le check ne devrait pas prendre plus de 60 secondes
|
||||
TimeoutStartSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,17 @@
|
||||
# =============================================================================
|
||||
# photobooth-watchdog.timer - Timer pour le watchdog (toutes les 2 minutes)
|
||||
# =============================================================================
|
||||
|
||||
[Unit]
|
||||
Description=Photomaton Health Check Timer
|
||||
|
||||
[Timer]
|
||||
# Lancer 1 minute apres le boot
|
||||
OnBootSec=60
|
||||
# Puis toutes les 2 minutes
|
||||
OnUnitActiveSec=120
|
||||
# Tolerence de 30 secondes (economie CPU)
|
||||
AccuracySec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user