mirror of
https://git.0x0.st/mia/0x0.git
synced 2024-11-21 16:47:11 +01:00
Add example systemd unit files for prune job
This commit is contained in:
parent
f25619b7e3
commit
db9a20c94d
3 changed files with 39 additions and 2 deletions
22
0x0-prune.service
Normal file
22
0x0-prune.service
Normal file
|
@ -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
|
9
0x0-prune.timer
Normal file
9
0x0-prune.timer
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Prune 0x0 files
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=hourly
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
10
README.rst
10
README.rst
|
@ -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,
|
problem for example when streaming media files: It won’t be possible to seek,
|
||||||
and some ISOBMFF (MP4) files will not play at all.
|
and some ISOBMFF (MP4) files will not play at all.
|
||||||
|
|
||||||
To make files expire, simply create a cronjob that runs ``FLASK_APP=fhost
|
To make files expire, simply run ``FLASK_APP=fhost flask prune`` every
|
||||||
flask prune`` every now and then.
|
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``.
|
Before running the service for the first time, run ``FLASK_APP=fhost flask db upgrade``.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue