-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcom.mproadmin.plexwatcher.plist
More file actions
75 lines (62 loc) · 2.86 KB
/
com.mproadmin.plexwatcher.plist
File metadata and controls
75 lines (62 loc) · 2.86 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Unique reverse-DNS label — used by launchctl to identify this agent -->
<key>Label</key>
<string>com.mproadmin.plexwatcher</string>
<!-- Full path to python3 + watcher.py -->
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/python3</string>
<string>/Users/mProAdmin/Claude Scripts and Venvs/plex-batch-optimizer/watcher.py</string>
<string>--boot-grace</string>
<string>600</string>
<string>--max-jobs-per-run</string>
<string>1</string>
<string>--inter-job-sleep</string>
<string>30</string>
</array>
<!-- Run every 5 minutes (300 seconds).
launchd wakes the job, runs it to completion, then resets the timer.
Safe on NFS — no filesystem events required. -->
<key>StartInterval</key>
<integer>300</integer>
<!-- Also run once immediately when the agent is loaded (on login / launchctl load) -->
<key>RunAtLoad</key>
<true/>
<!-- Do NOT keep alive — this is a run-to-exit job, not a daemon -->
<key>KeepAlive</key>
<false/>
<!-- stdout captured to a persistent log (launchd rotates automatically) -->
<key>StandardOutPath</key>
<string>/Users/mProAdmin/Claude Scripts and Venvs/plex-batch-optimizer/results/watcher_launchd_stdout.log</string>
<!-- stderr goes to a separate file for easy error triage -->
<key>StandardErrorPath</key>
<string>/Users/mProAdmin/Claude Scripts and Venvs/plex-batch-optimizer/results/watcher_launchd_stderr.log</string>
<!-- Working directory — so relative imports and paths work correctly -->
<key>WorkingDirectory</key>
<string>/Users/mProAdmin/Claude Scripts and Venvs/plex-batch-optimizer</string>
<!-- Environment: ensure PATH includes Homebrew bin so ffmpeg/ffprobe resolve -->
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<!-- Deprioritize entire process tree (watcher + ffmpeg children).
Background QoS yields CPU to foreground work automatically. -->
<key>ProcessType</key>
<string>Background</string>
<!-- nice 10 = well below default (0). Leaves ample headroom for
2-3 simultaneous Plex transcodes. ffmpeg subprocess additionally
calls os.nice(5) bringing effective ffmpeg nice to 10 even if
launchd agent priority drifts. -->
<key>Nice</key>
<integer>10</integer>
<!-- Throttle: if watcher.py exits with non-zero in under 10 seconds,
launchd waits 60s before retrying (prevents crash-loop hammering NAS) -->
<key>ThrottleInterval</key>
<integer>60</integer>
</dict>
</plist>