Fedora also has one, not upstream from what I can see.  This also doe more
restrictions on what it can see.

/usr/lib/systemd/system/mlocate-updatedb.service
[Unit]
Description=Update a database for mlocate

[Service]
ExecStart=/usr/libexec/mlocate-run-updatedb
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7

PrivateTmp=true
PrivateDevices=true
PrivateNetwork=true
ProtectSystem=true


/etc/systemd/system/timers.target.wants/mlocate-updatedb.timer
[Unit]
Description=Updates mlocate database every day

[Timer]
OnCalendar=daily
AccuracySec=24h
Persistent=true

[Install]


The last bit would be to take the cronjob line from logrotate (if you want
compatibility from systems without system):
# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
    exit 0
fi

Reply via email to