Repository navigation
Expand file tree
/
Copy pathpocketscope@.service
More file actions
51 lines (44 loc) · 1.92 KB
/
Copy pathpocketscope@.service
File metadata and controls
51 lines (44 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
[Unit]
Description=PocketScope live view (TFT) for user %i
Wants=network-online.target
After=network-online.target
StartLimitBurst=10
StartLimitIntervalSec=60
[Service]
Type=simple
# instance name (eg. pocketscope) is available as %i. NOTE: do not use %h here
# — in a system service %h expands to the *service manager's* home (/root),
# not User=%i's home. Since the instance name matches the username, build the
# home path explicitly as /home/%i (e.g. /home/pocketscope).
User=%i
WorkingDirectory=/home/%i/pocket-scope
# Load environment file from /etc/default/pocketscope if present, otherwise
# fall back to the user's environment (systemd will not expand $HOME in
# EnvironmentFile, so prefer /etc/default for system-wide installs). Keep the
# leading '-' to ignore missing files.
EnvironmentFile=-/etc/default/pocketscope
# Ensure Python output is unbuffered for logs
Environment=PYTHONUNBUFFERED=1
# Default runtime paths based on the user's home directory (/home/%i). These
# can be overridden in /etc/default/pocketscope if absolute paths are required.
Environment=POCKETSCOPE_HOME=/home/%i/.pocketscope
Environment=POCKETSCOPE_RUNWAYS_SQLITE=/home/%i/.pocketscope/runways.sqlite
Environment=POCKETSCOPE_RUNWAYS_FILE=/home/%i/pocket-scope/src/pocketscope/assets/runways.json
# ExecStart: use the per-user home path and a virtualenv if present under
# the repository. Fall back to the system python using ExecStartPre to
# detect the venv. For simplicity here, point to /home/%i/pocket-scope/.venv
# if it exists — administrators should create that venv in the user's repo.
ExecStart=/home/%i/pocket-scope/.venv/bin/python -m pocketscope \
--url ${POCKETSCOPE_URL} \
--center ${POCKETSCOPE_CENTER} \
--tft
KillSignal=SIGINT
TimeoutStopSec=15
Restart=always
RestartSec=3
# Uncomment if you need additional device access:
# SupplementaryGroups=gpio,spi,video
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target