Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #946617

Bug#923014: Add systemd unit - allow usage without cron installed

From Bryan Quigley <bryan.quigley@canonical.com>
Newsgroups linux.debian.bugs.dist
Subject Bug#923014: Add systemd unit - allow usage without cron installed
Date 2019-02-23 01:10 +0100
Message-ID <xut3b-OQ-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Package: popularity-contest
Version: 1.67

This is regards to the popularity-contest cron job.  I'm looking into
running systems without anacron/cron installed - instead using systemd
timers.

My suggestion would be to remove the what to do functionality from the
cron job/timing bits to another script - say popcon-runner.

The cron job could then be something like:
# skip in favour of systemd timer (from logrotate)
if [ -d /run/systemd/system ]; then
    exit 0
fi

<anything else cron specific needed to schedule when it runs>

popcon-runner

And creating a systemd timer/service for those that have systemd installed:

Timer File
/etc/systemd/system/timers.target.wants/popularity-contest.timer
[Unit]
Description=Sends popularity contest data

[Timer]
OnCalendar=daily
AccuracySec=24h  [ Can change this to be less accurate to spread
server load, etc)
Persistent=true

[Install]
WantedBy=timers.target

Service File
/usr/lib/systemd/system/popularity-contest.service
[Unit]
Description=Sends popularity contest data

[Service]
ExecStart=/path/to/popcon-runner
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7

(can easily set nice levels, IO limits)

PrivateTmp=true
PrivateDevices=true

There are a bunch of other restrictions that can be placed on it via
systemd Private directives.

Thanks!

Back to linux.debian.bugs.dist | Previous | Next | Find similar | Unroll thread


Thread

Bug#923014: Add systemd unit - allow usage without cron installed Bryan Quigley <bryan.quigley@canonical.com> - 2019-02-23 01:10 +0100

csiph-web