diff options
| author | Mia Herkt <mia@0x0.st> | 2022-11-29 17:23:30 +0100 |
|---|---|---|
| committer | Mia Herkt <mia@0x0.st> | 2022-11-29 17:23:30 +0100 |
| commit | db9a20c94d395b273caf24dfcc6a48ab3d020768 (patch) | |
| tree | bd1685007d580e2d0f8f0e3feb879f082d491a7c | |
| parent | f25619b7e3f7f6618b5e3fecc57cb08fdb67c2a9 (diff) | |
Add example systemd unit files for prune job
| -rw-r--r-- | 0x0-prune.service | 22 | ||||
| -rw-r--r-- | 0x0-prune.timer | 9 | ||||
| -rw-r--r-- | README.rst | 10 |
3 files changed, 39 insertions, 2 deletions
diff --git a/0x0-prune.service b/0x0-prune.service new file mode 100644 index 0000000..b28fb2d --- /dev/null +++ b/0x0-prune.service @@ -0,0 +1,22 @@ +[Unit] +Description=Prune 0x0 files +After=remote-fs.target + +[Service] +Type=oneshot +User=nullptr +WorkingDirectory=/path/to/0x0 +BindPaths=/path/to/0x0 + +Environment=FLASK_APP=fhost +ExecStart=/usr/bin/flask prune +ProtectProc=noaccess +ProtectSystem=strict +ProtectHome=tmpfs +PrivateTmp=true +PrivateUsers=true +ProtectKernelLogs=true +LockPersonality=true + +[Install] +WantedBy=multi-user.target diff --git a/0x0-prune.timer b/0x0-prune.timer new file mode 100644 index 0000000..df6a594 --- /dev/null +++ b/0x0-prune.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Prune 0x0 files + +[Timer] +OnCalendar=hourly +Persistent=true + +[Install] +WantedBy=timers.target @@ -35,8 +35,14 @@ downsides, one of them being that range requests will not work. This is a problem for example when streaming media files: It won’t be possible to seek, and some ISOBMFF (MP4) files will not play at all. -To make files expire, simply create a cronjob that runs ``FLASK_APP=fhost -flask prune`` every now and then. +To make files expire, simply run ``FLASK_APP=fhost flask prune`` every +now and then. You can use the provided systemd unit files for this:: + + 0x0-prune.service + 0x0-prune.timer + +Make sure to edit them to match your system configuration. In particular, +set the user and paths in ``0x0-prune.service``. Before running the service for the first time, run ``FLASK_APP=fhost flask db upgrade``. |
