summaryrefslogtreecommitdiff
path: root/bin/systemd-email
blob: 844475814626e3158f08ab491ce2763e9c0d1060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

if [ $# -ne 1 ]; then
  >&2 echo 'systemd-email unit-name.service'
  >&2 echo '  send an email about a systemd unit'
  exit 2
fi

{
  printf 'To: archlinux32-logs@eckner.net\n'
  printf 'From: systemd <%s@%s>\n' \
    "$(whoami)" \
    "$(hostname)"
  printf 'Subject: %s\n' \
    "$1"
  printf 'Content-Transfer-Encoding: 8bit\n'
  printf 'Content-Type: text/plain; charset=UTF-8\n'
  printf '\n'
  systemctl --user status --full --lines=50 "$1"
} | \
  /usr/bin/digest-mailer