On Thu, 08 Dec 2016 at 07:55:33 +0100, Lucas Nussbaum wrote:
> [0] for services that currently run via cron, it would be interesting to
> transition to running them using systemd service + timer, so that it's
> easy to run the service manually in the same environment when run
> manually (systemctl start foo.service). I don't know if it's possible to
> do that, and still use journal for logging, with a systemd user
> instance.

Yes, it is. You write a "user service" in /usr/lib/systemd/user instead
of a system service in /lib/systemd/system. gpg-agent.service in sid
is a good example. User services get their stdout/stderr sent to the
Journal by default, just like system services. If they log to syslog
or use journald logging APIs explicitly, that also goes to the Journal.

You need partial administrative privileges (group "adm" or "systemd-journal"
membership) to *read* the Journal, unless you have configured persistent
storage (usually done by creating /var/log/journal). This is because the
default SplitMode=uid, which gives each uid their own Journal file that
they can read without administrative privileges, is not active when journald
is only writing to /run/log.

I would still advocate using VM-based infrastructure for infrastructure
development, because that lets the developer run the service a lot more
realistically, with its intended uid/privilege-separation, paths and
so on.

    S

Reply via email to